upload_check_payment_method - Version 0.1.2

Version Notes

Upload check payment method

Download this release

Release Info

Developer Magebuzz
Extension upload_check_payment_method
Version 0.1.2
Comparing to
See all releases


Version 0.1.2

Files changed (106) hide show
  1. app/code/community/Magebuzz/Info/Block/System/Config/Extensions (2).php +75 -0
  2. app/code/community/Magebuzz/Info/Block/System/Config/Extensions.php +75 -0
  3. app/code/community/Magebuzz/Info/Block/System/Config/General.php +21 -0
  4. app/code/community/Magebuzz/Info/Helper/Data.php +4 -0
  5. app/code/community/Magebuzz/Info/Model/Feed.php +45 -0
  6. app/code/community/Magebuzz/Info/etc/adminhtml.xml +25 -0
  7. app/code/community/Magebuzz/Info/etc/config.xml +85 -0
  8. app/code/community/Magebuzz/Info/etc/system.xml +61 -0
  9. app/code/community/Magebuzz/Scancheck/Block/Form/Upload.php +9 -0
  10. app/code/community/Magebuzz/Scancheck/Block/Info/Upload.php +9 -0
  11. app/code/community/Magebuzz/Scancheck/Helper/Data.php +20 -0
  12. app/code/community/Magebuzz/Scancheck/Model/File.php +28 -0
  13. app/code/community/Magebuzz/Scancheck/Model/Mysql4/File.php +23 -0
  14. app/code/community/Magebuzz/Scancheck/Model/Mysql4/File/Collection.php +10 -0
  15. app/code/community/Magebuzz/Scancheck/Model/Mysql4/Order.php +23 -0
  16. app/code/community/Magebuzz/Scancheck/Model/Mysql4/Order/Collection.php +10 -0
  17. app/code/community/Magebuzz/Scancheck/Model/Observer.php +73 -0
  18. app/code/community/Magebuzz/Scancheck/Model/Order.php +21 -0
  19. app/code/community/Magebuzz/Scancheck/Model/Scancheck.php +32 -0
  20. app/code/community/Magebuzz/Scancheck/controllers/IndexController.php +28 -0
  21. app/code/community/Magebuzz/Scancheck/etc/config.xml +138 -0
  22. app/code/community/Magebuzz/Scancheck/etc/system.xml +70 -0
  23. app/code/community/Magebuzz/Scancheck/sql/scancheck_setup/mysql4-install-0.1.0.php +12 -0
  24. app/code/community/Magebuzz/Scancheck/sql/scancheck_setup/mysql4-upgrade-0.1.0-0.1.1.php +26 -0
  25. app/design/adminhtml/default/default/layout/scancheck.xml +1 -0
  26. app/design/adminhtml/default/default/template/scancheck/order.phtml +22 -0
  27. app/design/adminhtml/default/default/template/scancheck/sales/order/info.phtml +9 -0
  28. app/design/frontend/base/default/layout/scancheck.xml +14 -0
  29. app/design/frontend/base/default/template/scancheck/form/upload.phtml +32 -0
  30. app/design/frontend/base/default/template/scancheck/info.phtml +1 -0
  31. app/etc/modules/Magebuzz_Info.xml +9 -0
  32. app/etc/modules/Magebuzz_Scancheck.xml +9 -0
  33. app/locale/en_US/template/email/paymentfile.html +12 -0
  34. package.xml +18 -0
  35. skin/frontend/base/default/css/magebuzz/scancheck.css +3 -0
  36. skin/frontend/base/default/uploadfile/cancel.png +0 -0
  37. skin/frontend/base/default/uploadfile/check.php +35 -0
  38. skin/frontend/base/default/uploadfile/com/adobe/air/logging/FileTarget.as +98 -0
  39. skin/frontend/base/default/uploadfile/com/adobe/crypto/HMAC.as +127 -0
  40. skin/frontend/base/default/uploadfile/com/adobe/crypto/MD5.as +281 -0
  41. skin/frontend/base/default/uploadfile/com/adobe/crypto/MD5Stream.as +402 -0
  42. skin/frontend/base/default/uploadfile/com/adobe/crypto/SHA1.as +271 -0
  43. skin/frontend/base/default/uploadfile/com/adobe/crypto/SHA224.as +257 -0
  44. skin/frontend/base/default/uploadfile/com/adobe/crypto/SHA256.as +261 -0
  45. skin/frontend/base/default/uploadfile/com/adobe/crypto/WSSEUsernameToken.as +114 -0
  46. skin/frontend/base/default/uploadfile/com/adobe/errors/IllegalStateError.as +63 -0
  47. skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/Address.as +47 -0
  48. skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/Email.as +39 -0
  49. skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/Phone.as +39 -0
  50. skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/VCard.as +54 -0
  51. skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/VCardParser.as +246 -0
  52. skin/frontend/base/default/uploadfile/com/adobe/images/BitString.as +39 -0
  53. skin/frontend/base/default/uploadfile/com/adobe/images/JPGEncoder.as +648 -0
  54. skin/frontend/base/default/uploadfile/com/adobe/images/PNGEncoder.as +141 -0
  55. skin/frontend/base/default/uploadfile/com/adobe/net/DynamicURLLoader.as +55 -0
  56. skin/frontend/base/default/uploadfile/com/adobe/net/IURIResolver.as +76 -0
  57. skin/frontend/base/default/uploadfile/com/adobe/net/MimeTypeMap.as +196 -0
  58. skin/frontend/base/default/uploadfile/com/adobe/net/URI.as +2466 -0
  59. skin/frontend/base/default/uploadfile/com/adobe/net/URIEncodingBitmap.as +139 -0
  60. skin/frontend/base/default/uploadfile/com/adobe/net/proxies/RFC2817Socket.as +198 -0
  61. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Database.as +34 -0
  62. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Definition.as +39 -0
  63. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Dict.as +328 -0
  64. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/DictionaryServer.as +28 -0
  65. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/MatchStrategy.as +34 -0
  66. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Response.as +39 -0
  67. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/ConnectedEvent.as +14 -0
  68. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DatabaseEvent.as +26 -0
  69. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DefinitionEvent.as +27 -0
  70. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as +26 -0
  71. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DictionaryServerEvent.as +26 -0
  72. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DisconnectedEvent.as +14 -0
  73. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/ErrorEvent.as +37 -0
  74. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/MatchEvent.as +26 -0
  75. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/MatchStrategiesEvent.as +26 -0
  76. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/NoMatchEvent.as +14 -0
  77. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/util/CompleteResponseEvent.as +25 -0
  78. skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/util/SocketHelper.as +49 -0
  79. skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSON.as +85 -0
  80. skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONDecoder.as +221 -0
  81. skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONEncoder.as +299 -0
  82. skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONParseError.as +87 -0
  83. skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONToken.as +104 -0
  84. skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONTokenType.as +67 -0
  85. skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONTokenizer.as +583 -0
  86. skin/frontend/base/default/uploadfile/com/adobe/utils/ArrayUtil.as +187 -0
  87. skin/frontend/base/default/uploadfile/com/adobe/utils/DateUtil.as +699 -0
  88. skin/frontend/base/default/uploadfile/com/adobe/utils/DictionaryUtil.as +87 -0
  89. skin/frontend/base/default/uploadfile/com/adobe/utils/IntUtil.as +99 -0
  90. skin/frontend/base/default/uploadfile/com/adobe/utils/NumberFormatter.as +74 -0
  91. skin/frontend/base/default/uploadfile/com/adobe/utils/StringUtil.as +270 -0
  92. skin/frontend/base/default/uploadfile/com/adobe/utils/XMLUtil.as +168 -0
  93. skin/frontend/base/default/uploadfile/com/adobe/webapis/ServiceBase.as +48 -0
  94. skin/frontend/base/default/uploadfile/com/adobe/webapis/URLLoaderBase.as +108 -0
  95. skin/frontend/base/default/uploadfile/com/adobe/webapis/events/ServiceEvent.as +75 -0
  96. skin/frontend/base/default/uploadfile/expressInstall.swf +0 -0
  97. skin/frontend/base/default/uploadfile/jquery-1.4.2.min.js +154 -0
  98. skin/frontend/base/default/uploadfile/jquery.uploadify.v2.1.4.js +296 -0
  99. skin/frontend/base/default/uploadfile/jquery.uploadify.v2.1.4.min.js +26 -0
  100. skin/frontend/base/default/uploadfile/noconflict.js +1 -0
  101. skin/frontend/base/default/uploadfile/swfobject.js +4 -0
  102. skin/frontend/base/default/uploadfile/uploadify.allglyphs.swf +0 -0
  103. skin/frontend/base/default/uploadfile/uploadify.css +52 -0
  104. skin/frontend/base/default/uploadfile/uploadify.fla +0 -0
  105. skin/frontend/base/default/uploadfile/uploadify.php +46 -0
  106. skin/frontend/base/default/uploadfile/uploadify.swf +0 -0
app/code/community/Magebuzz/Info/Block/System/Config/Extensions (2).php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Info_Block_System_Config_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
3
+ public function render(Varien_Data_Form_Element_Abstract $element) {
4
+ $html = $this->_getHeaderHtml($element);
5
+
6
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
7
+ sort($modules);
8
+
9
+ foreach ($modules as $moduleName) {
10
+ if (strstr($moduleName, 'Magebuzz_') === false) {
11
+ continue;
12
+ }
13
+ if ($moduleName == 'Magebuzz_Info') {
14
+ continue;
15
+ }
16
+ $html.= $this->_getFieldHtml($element, $moduleName);
17
+ }
18
+
19
+ $html .= $this->_getFooterHtml($element);
20
+ return $html;
21
+ }
22
+
23
+ protected function _getFieldHtml($fieldset, $moduleCode) {
24
+ $currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
25
+
26
+ if (!$currentVer) {
27
+ return '';
28
+ }
29
+ $moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1);
30
+ $allExtensions = unserialize(Mage::app()->loadCache('mb_extensions'));
31
+ $status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
32
+
33
+ if ($allExtensions && isset($allExtensions[$moduleCode])){
34
+ $ext = $allExtensions[$moduleCode];
35
+ $url = $ext['url'];
36
+ $name = $ext['name'];
37
+ $lastVer = $ext['version'];
38
+
39
+ $moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
40
+ if ($this->_convertVersion($currentVer) < $this->_convertVersion($lastVer)) {
41
+ $status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
42
+ }
43
+ }
44
+
45
+ $moduleName = $status . ' ' . $moduleName;
46
+
47
+ $field = $fieldset->addField($moduleCode, 'label', array(
48
+ 'name' => 'dummy',
49
+ 'label' => $moduleName,
50
+ 'value' => $currentVer,
51
+ ))->setRenderer($this->_getFieldRenderer());
52
+
53
+ return $field->toHtml();
54
+ }
55
+
56
+ protected function _getFieldRenderer() {
57
+ if (empty($this->_fieldRenderer)) {
58
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
59
+ }
60
+ return $this->_fieldRenderer;
61
+ }
62
+
63
+ protected function _convertVersion($v) {
64
+ $digits = @explode(".", $v);
65
+ $version = 0;
66
+ if (is_array($digits)){
67
+ foreach ($digits as $k=>$v){
68
+ $version += ($v * pow(10, max(0, (3-$k))));
69
+ }
70
+
71
+ }
72
+ return $version;
73
+ }
74
+
75
+ }
app/code/community/Magebuzz/Info/Block/System/Config/Extensions.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Info_Block_System_Config_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
3
+ public function render(Varien_Data_Form_Element_Abstract $element) {
4
+ $html = $this->_getHeaderHtml($element);
5
+
6
+ $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
7
+ sort($modules);
8
+
9
+ foreach ($modules as $moduleName) {
10
+ if (strstr($moduleName, 'Magebuzz_') === false) {
11
+ continue;
12
+ }
13
+ if ($moduleName == 'Magebuzz_Info') {
14
+ continue;
15
+ }
16
+ $html.= $this->_getFieldHtml($element, $moduleName);
17
+ }
18
+
19
+ $html .= $this->_getFooterHtml($element);
20
+ return $html;
21
+ }
22
+
23
+ protected function _getFieldHtml($fieldset, $moduleCode) {
24
+ $currentVer = Mage::getConfig()->getModuleConfig($moduleCode)->version;
25
+
26
+ if (!$currentVer) {
27
+ return '';
28
+ }
29
+ $moduleName = substr($moduleCode, strpos($moduleCode, '_') + 1);
30
+ $allExtensions = unserialize(Mage::app()->loadCache('mb_extensions'));
31
+ $status = '<a target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/ok.gif').'" title="'.$this->__("Installed").'"/></a>';
32
+
33
+ if ($allExtensions && isset($allExtensions[$moduleCode])){
34
+ $ext = $allExtensions[$moduleCode];
35
+ $url = $ext['url'];
36
+ $name = $ext['name'];
37
+ $lastVer = $ext['version'];
38
+
39
+ $moduleName = '<a href="'.$url.'" target="_blank" title="'.$name.'">'.$name."</a>";
40
+ if ($this->_convertVersion($currentVer) < $this->_convertVersion($lastVer)) {
41
+ $status = '<a href="'.$url.'" target="_blank"><img src="'.$this->getSkinUrl('images/magebuzz/update.gif').'" alt="'.$this->__("Update available").'" title="'.$this->__("Update available").'"/></a>';
42
+ }
43
+ }
44
+
45
+ $moduleName = $status . ' ' . $moduleName;
46
+
47
+ $field = $fieldset->addField($moduleCode, 'label', array(
48
+ 'name' => 'dummy',
49
+ 'label' => $moduleName,
50
+ 'value' => $currentVer,
51
+ ))->setRenderer($this->_getFieldRenderer());
52
+
53
+ return $field->toHtml();
54
+ }
55
+
56
+ protected function _getFieldRenderer() {
57
+ if (empty($this->_fieldRenderer)) {
58
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
59
+ }
60
+ return $this->_fieldRenderer;
61
+ }
62
+
63
+ protected function _convertVersion($v) {
64
+ $digits = @explode(".", $v);
65
+ $version = 0;
66
+ if (is_array($digits)){
67
+ foreach ($digits as $k=>$v){
68
+ $version += ($v * pow(10, max(0, (3-$k))));
69
+ }
70
+
71
+ }
72
+ return $version;
73
+ }
74
+
75
+ }
app/code/community/Magebuzz/Info/Block/System/Config/General.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Info_Block_System_Config_General extends Mage_Adminhtml_Block_System_Config_Form_Fieldset {
3
+ public function render(Varien_Data_Form_Element_Abstract $element) {
4
+ $html = $this->_getHeaderHtml($element);
5
+
6
+ $html .= $this->_getInfo();
7
+
8
+ $html .= $this->_getFooterHtml($element);
9
+ return $html;
10
+ }
11
+
12
+ protected function _getInfo() {
13
+ $html = '<div class="support-info">';
14
+ $html .= '<h3>Support Policy</h3>';
15
+ $html .= '<p>We provide 6 months free support for all of our extensions and templates. We are not responsible for any bug or issue caused of your changes to our products. To report a bug, you can easily go to <a href="http://www.magebuzz.com/support/" title="Magebuzz Support" target="_blank">our Support Page</a>, email, call or submit a ticket.</p>';
16
+ $html .= '<h3>Read the blog</h3><p>The <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> is updated regularly with Magento tutorials, Magebuzz new products, updates, promotions... Visit <a href="http://www.magebuzz.com/blog/" target="_blank">Magebuzz Blog</a> recently to be kept updated.</p>';
17
+ $html .= '<h3>Follow Us</h3><div class="magebuzz-follow"><ul><li style="float:left" class="facebook"><a href="http://www.facebook.com/MageBuzz" title="Facebook" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/facebook.png') . '" alt="Facebook"/></a></li><li style="float:left" class="twitter"><a href="https://twitter.com/MageBuzz" title="Twitter" target="_blank"><img src="' . $this->getSkinUrl('images/magebuzz/twitter.png') . '" alt="Twitter"/></a></li></ul></div>';
18
+ $html .= '</div>';
19
+ return $html;
20
+ }
21
+ }
app/code/community/Magebuzz/Info/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Info_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
app/code/community/Magebuzz/Info/Model/Feed.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Info_Model_Feed extends Mage_AdminNotification_Model_Feed {
3
+ const URL_NEWS = 'http://www.magebuzz.com/feed_news.xml';
4
+
5
+ public function _construct() {
6
+ parent::_construct();
7
+ $this->_init('info/feed');
8
+ }
9
+
10
+ public function checkUpdate() {
11
+ if (!extension_loaded('curl')) {
12
+ return $this;
13
+ }
14
+ if (!Mage::getStoreConfig('info/notification/enable')) {
15
+ return $this;
16
+ }
17
+ $feedData = array();
18
+ $feedXml = $this->getFeedData();
19
+
20
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
21
+ foreach ($feedXml->channel->item as $item) {
22
+ $date = $this->getDate((string)$item->pubDate);
23
+ $feedData[] = array(
24
+ 'severity' => 3,
25
+ 'date_added' => $this->getDate($date),
26
+ 'title' => (string)$item->title,
27
+ 'description' => (string)$item->description,
28
+ 'url' => (string)$item->link,
29
+ );
30
+ }
31
+ if ($feedData) {
32
+ Mage::getModel('adminnotification/inbox')->parse(array_reverse($feedData));
33
+ }
34
+ }
35
+ $this->setLastUpdate();
36
+ }
37
+
38
+ public function getFeedUrl() {
39
+ if (is_null($this->_feedUrl)) {
40
+ $this->_feedUrl = self::URL_NEWS;
41
+ }
42
+ //$query = '?s=' . urlencode(Mage::getStoreConfig('web/unsecure/base_url'));
43
+ return $this->_feedUrl;
44
+ }
45
+ }
app/code/community/Magebuzz/Info/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <info>
15
+ <title>Magebuzz Info</title>
16
+ </info>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/community/Magebuzz/Info/etc/config.xml ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magebuzz_Info>
5
+ <version>0.1.0</version>
6
+ </Magebuzz_Info>
7
+ </modules>
8
+ <admin>
9
+ <routers>
10
+ <info>
11
+ <use>admin</use>
12
+ <args>
13
+ <module>Magebuzz_Info</module>
14
+ <frontName>info</frontName>
15
+ </args>
16
+ </info>
17
+ </routers>
18
+ </admin>
19
+ <adminhtml>
20
+ <events>
21
+ <controller_action_predispatch>
22
+ <observers>
23
+ <magebuzz_info_feed>
24
+ <type>singleton</type>
25
+ <class>info/feed</class>
26
+ <method>checkUpdate</method>
27
+ </magebuzz_info_feed>
28
+ </observers>
29
+ </controller_action_predispatch>
30
+ </events>
31
+ </adminhtml>
32
+ <global>
33
+ <models>
34
+ <info>
35
+ <class>Magebuzz_Info_Model</class>
36
+ <resourceModel>info_mysql4</resourceModel>
37
+ </info>
38
+ <info_mysql4>
39
+ <class>Magebuzz_Info_Model_Mysql4</class>
40
+ <entities>
41
+ <info>
42
+ <table>info</table>
43
+ </info>
44
+ </entities>
45
+ </info_mysql4>
46
+ </models>
47
+ <resources>
48
+ <info_setup>
49
+ <setup>
50
+ <module>Magebuzz_Info</module>
51
+ </setup>
52
+ <connection>
53
+ <use>core_setup</use>
54
+ </connection>
55
+ </info_setup>
56
+ <info_write>
57
+ <connection>
58
+ <use>core_write</use>
59
+ </connection>
60
+ </info_write>
61
+ <info_read>
62
+ <connection>
63
+ <use>core_read</use>
64
+ </connection>
65
+ </info_read>
66
+ </resources>
67
+ <blocks>
68
+ <info>
69
+ <class>Magebuzz_Info_Block</class>
70
+ </info>
71
+ </blocks>
72
+ <helpers>
73
+ <info>
74
+ <class>Magebuzz_Info_Helper</class>
75
+ </info>
76
+ </helpers>
77
+ </global>
78
+ <default>
79
+ <info>
80
+ <notification>
81
+ <enable>1</enable>
82
+ </notification>
83
+ </info>
84
+ </default>
85
+ </config>
app/code/community/Magebuzz/Info/etc/system.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <magebuzz translate="label">
5
+ <label>MageBuzz Add-ons</label>
6
+ <sort_order>400</sort_order>
7
+ </magebuzz>
8
+ </tabs>
9
+ <sections>
10
+ <info translate="label" module="info">
11
+ <class>separator-top</class>
12
+ <label>Info</label>
13
+ <tab>magebuzz</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>999</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>0</show_in_store>
19
+ <groups>
20
+ <general translate="label">
21
+ <label>Info</label>
22
+ <frontend_type>text</frontend_type>
23
+ <frontend_model>info/system_config_general</frontend_model>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>0</show_in_store>
28
+ </general>
29
+ <installed_extensions translate="label">
30
+ <label>Installed Magebuzz Extensions</label>
31
+ <frontend_type>text</frontend_type>
32
+ <frontend_model>info/system_config_extensions</frontend_model>
33
+ <sort_order>2</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>0</show_in_store>
37
+ </installed_extensions>
38
+ <notification translate="label">
39
+ <label>Notification</label>
40
+ <frontend_type>text</frontend_type>
41
+ <comment><![CDATA[<p style="color:#EA7601">Select Yes to receive notification about new extensions, templates, updates or promotions and discounts from Magebuzz Store.</p>]]></comment>
42
+ <sort_order>3</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>0</show_in_store>
46
+ <fields>
47
+ <enable>
48
+ <label>Receive Notification about new product, update and promotions</label>
49
+ <sort_order>1</sort_order>
50
+ <show_in_default>1</show_in_default>
51
+ <show_in_website>1</show_in_website>
52
+ <show_in_store>0</show_in_store>
53
+ <frontend_type>select</frontend_type>
54
+ <source_model>adminhtml/system_config_source_yesno</source_model>
55
+ </enable>
56
+ </fields>
57
+ </notification>
58
+ </groups>
59
+ </info>
60
+ </sections>
61
+ </config>
app/code/community/Magebuzz/Scancheck/Block/Form/Upload.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Scancheck_Block_Form_Upload extends Mage_Payment_Block_Form
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('scancheck/form/upload.phtml');
8
+ }
9
+ }
app/code/community/Magebuzz/Scancheck/Block/Info/Upload.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Scancheck_Block_Info_Upload extends Mage_Payment_Block_Info
3
+ {
4
+ protected function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->setTemplate('scancheck/sales/order/info.phtml');
8
+ }
9
+ }
app/code/community/Magebuzz/Scancheck/Helper/Data.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Scancheck_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function getAttachmentFolder($filename) {
6
+ $attachment_path = Mage::getBaseDir('media') . DS .'uploads' . DS. $filename;
7
+ if(!is_dir($attachment_path)) {
8
+ try{
9
+ chmod(Mage::getBaseDir('media'),0777);
10
+ mkdir($attachment_path);
11
+ chmod($attachment_path,0777);
12
+ return $attachment_path;
13
+
14
+ } catch(Exception $e) {
15
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
16
+ }
17
+ }
18
+ return $attachment_path;
19
+ }
20
+ }
app/code/community/Magebuzz/Scancheck/Model/File.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Scancheck_Model_File extends Mage_Core_Model_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('scancheck/file');
8
+ }
9
+ public function resetUniqId(){
10
+ Mage::getSingleton('core/session')->setFileUniq(false);
11
+ }
12
+ public function getUniqueId($quote){
13
+ $uniq = Mage::getSingleton('core/session')->getFileUniq();
14
+ if($uniq){
15
+ }else{
16
+ $uniq =substr(md5(uniqid()), 0,8);
17
+ Mage::getSingleton('core/session')->setFileUniq($uniq);
18
+ }
19
+ return $uniq;
20
+ }
21
+ public function saveFile($quote_id,$filename,$type){
22
+ $this->getResource()->deleteFile($quote_id,$filename,$type);
23
+ $this->setFilename($filename);
24
+ $this->setQuoteId($quote_id);
25
+ $this->setType($type);
26
+ $this->save();
27
+ }
28
+ }
app/code/community/Magebuzz/Scancheck/Model/Mysql4/File.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Scancheck_Model_Mysql4_File extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the file_id refers to the key field in your database table.
8
+ $this->_init('scancheck/sales_quote_payment_file', 'id');
9
+ }
10
+ public function deleteFile($quote_id,$filename,$type){
11
+ $table = $this->getMainTable();
12
+
13
+ $where = $this->_getReadAdapter()->quoteInto('quote_id = ? and ',$quote_id).
14
+ $this->_getReadAdapter()->quoteInto('`type` = ? ',$type);
15
+ $select = $this->_getReadAdapter()->select()->from($table)->where($where);
16
+
17
+ Mage::log($select.'');
18
+ $rows = $this->_getReadAdapter()->fetchAll($select);
19
+ if(sizeof($rows) > 0){
20
+ $this->_getWriteAdapter()->delete($table,$where);
21
+ }
22
+ }
23
+ }
app/code/community/Magebuzz/Scancheck/Model/Mysql4/File/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Scancheck_Model_Mysql4_File_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('scancheck/file');
9
+ }
10
+ }
app/code/community/Magebuzz/Scancheck/Model/Mysql4/Order.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Scancheck_Model_Mysql4_Order extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the file_id refers to the key field in your database table.
8
+ $this->_init('scancheck/sales_order_payment_file', 'id');
9
+ }
10
+ public function deleteFile($order_id,$filename,$type){
11
+ $table = $this->getMainTable();
12
+
13
+ $where = $this->_getReadAdapter()->quoteInto('order_id = ? and ',$order_id).
14
+ $this->_getReadAdapter()->quoteInto('`type` = ? ',$type);
15
+ $select = $this->_getReadAdapter()->select()->from($table)->where($where);
16
+
17
+ Mage::log($select.'');
18
+ $rows = $this->_getReadAdapter()->fetchAll($select);
19
+ if(sizeof($rows) > 0){
20
+ $this->_getWriteAdapter()->delete($table,$where);
21
+ }
22
+ }
23
+ }
app/code/community/Magebuzz/Scancheck/Model/Mysql4/Order/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magebuzz_Scancheck_Model_Mysql4_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('scancheck/order');
9
+ }
10
+ }
app/code/community/Magebuzz/Scancheck/Model/Observer.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Scancheck_Model_Observer
3
+ {
4
+ const XML_PATH_EMAIL_RECIPIENT = 'payment/scancheck/mailing_address';
5
+ const XML_PATH_EMAIL_SENDER = 'payment/scancheck/email_admin_sender';
6
+ const XML_PATH_EMAIL_TEMPLATE = 'payment/scancheck/email_admin_template';
7
+
8
+ public function saveQuoteAfter($evt){
9
+ $quote = $evt->getQuote();
10
+
11
+ $post = Mage::app()->getRequest()->getPost();
12
+
13
+ if(isset($post['file_upload_path'])){
14
+ $quote_id = $quote->getId();
15
+ $filename = $post['file_upload_path'];
16
+ $type = $post['file_upload_type'];
17
+ Mage::log($quote_id.'xx'.$filename);
18
+ Mage::getModel('scancheck/file')->saveFile($quote_id,$filename,$type);
19
+ }
20
+
21
+ }
22
+ public function placeOrderAfter($evt)
23
+ {
24
+ $order = $evt->getOrder();
25
+ $quote = $evt->getQuote();
26
+
27
+ $quote_id = $quote->getId();
28
+ $order_id = $order->getId();
29
+
30
+ $collection = Mage::getModel('scancheck/file')->getCollection();
31
+ $collection->addFieldToFilter('quote_id',$quote_id);
32
+
33
+ Mage::log('Observer Place Order After Quote ID:' . $quote_id);
34
+
35
+ foreach($collection as $object){
36
+ Mage::getModel('scancheck/order')->saveFile($order_id,$object->getFilename(),$object->getType());
37
+ $object->delete();
38
+ }
39
+ // send mail to admin
40
+ $translate = Mage::getSingleton('core/translate');
41
+ $translate->setTranslateInline(false);
42
+ $customerName = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
43
+ $increment_id = $order->getIncrementId();
44
+ $timeplaceorder = $order->getCreatedAtFormated('long');
45
+ $fileUrl = Mage::getBaseUrl('media')."uploads". $object->getFilename();
46
+ $imagePath = Mage::getBaseDir('media').DS."uploads".DS.$object->getFilename();
47
+
48
+ $fileName = basename($imagePath);
49
+ try {
50
+ $mailTemplate = Mage::getModel('core/email_template');
51
+ /* Add Attachment */
52
+ $mailTemplate->getMail()->createAttachment(file_get_contents($imagePath))->filename = $fileName;
53
+ $mailTemplate->setDesignConfig(array('area' => 'frontend'))
54
+ ->setReplyTo($order->getCustomerEmail())
55
+ ->sendTransactional(
56
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE),
57
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
58
+ Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT),
59
+ null,
60
+ array('increment_id' => $increment_id, 'place_order_time' => $timeplaceorder, 'file_attach_url' => $fileUrl, 'customer_name' => $customerName)
61
+ );
62
+
63
+ if (!$mailTemplate->getSentSuccess()) {
64
+ throw new Exception();
65
+ }
66
+ }
67
+ catch(Exception $e){
68
+ echo $e->getMessage();
69
+ return;
70
+ }
71
+ $translate->setTranslateInline(true);
72
+ }
73
+ }
app/code/community/Magebuzz/Scancheck/Model/Order.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Scancheck_Model_Order extends Mage_Core_Model_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('scancheck/order');
8
+ }
9
+ public function saveFile($order_id,$filename,$type){
10
+ $this->getResource()->deleteFile($order_id,$filename,$type);
11
+ $this->setFilename($filename);
12
+ $this->setOrderId($order_id);
13
+ $this->setType($type);
14
+ $this->save();
15
+ }
16
+ public function getFiles($order){
17
+ $collection = Mage::getModel('scancheck/order')->getCollection();
18
+ $collection->addFieldToFilter('order_id',$order->getId());
19
+ return $collection;
20
+ }
21
+ }
app/code/community/Magebuzz/Scancheck/Model/Scancheck.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magebuzz_Scancheck_Model_Scancheck extends Mage_Payment_Model_Method_Abstract
3
+ {
4
+ protected $_code = 'scancheck';
5
+ protected $_formBlockType = 'scancheck/form_upload';
6
+ protected $_infoBlockType = 'scancheck/info_upload';
7
+
8
+
9
+ public function assignData($data)
10
+ {
11
+ if (!($data instanceof Varien_Object)) {
12
+ $data = new Varien_Object($data);
13
+ }
14
+ $info = $this->getInfoInstance();
15
+ $info->setFileCheck($data->getFileCheck());
16
+ return $this;
17
+ }
18
+
19
+
20
+ public function validate()
21
+ {
22
+ parent::validate();
23
+
24
+ $info = $this->getInfoInstance();
25
+
26
+ $fileupload = $info->getFileCheck();
27
+ if($errorMsg){
28
+ Mage::throwException($errorMsg);
29
+ }
30
+ return $this;
31
+ }
32
+ }
app/code/community/Magebuzz/Scancheck/controllers/IndexController.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
3
+ class Magebuzz_Scancheck_IndexController extends Mage_Checkout_OnepageController
4
+ {
5
+ public function uploadAction()
6
+ {
7
+ Mage::log($_FILES);
8
+ if ($data = $this->getRequest()->getPost()) {
9
+
10
+ $type = 'file';
11
+ if(isset($_FILES[$type]['name']) && $_FILES[$type]['name'] != '') {
12
+ try {
13
+ $uploader = new Varien_File_Uploader($type);
14
+ //$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
15
+ $uploader->setAllowRenameFiles(true);
16
+ $uploader->setFilesDispersion(true);
17
+ $path = Mage::getBaseDir('media') . DS . 'uploads' . DS;
18
+ $uploader->save($path, $_FILES[$type]['name'] );
19
+ $filename = $uploader->getUploadedFileName();
20
+
21
+ } catch (Exception $e) {
22
+ }
23
+
24
+ }
25
+ echo $filename;
26
+ }
27
+ }
28
+ }
app/code/community/Magebuzz/Scancheck/etc/config.xml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magebuzz_Scancheck>
5
+ <version>0.1.2</version>
6
+ </Magebuzz_Scancheck>
7
+ </modules>
8
+ <frontend>
9
+ <secure_url>
10
+ <scancheck>/scancheck/</scancheck>
11
+ </secure_url>
12
+ <routers>
13
+ <scancheck>
14
+ <use>standard</use>
15
+ <args>
16
+ <module>Magebuzz_Scancheck</module>
17
+ <frontName>scancheck</frontName>
18
+ </args>
19
+ </scancheck>
20
+ </routers>
21
+ <layout>
22
+ <updates>
23
+ <scancheck>
24
+ <file>scancheck.xml</file>
25
+ </scancheck>
26
+ </updates>
27
+ </layout>
28
+ </frontend>
29
+ <global>
30
+ <fieldsets>
31
+ <sales_convert_quote_payment>
32
+ <file_check>
33
+ <to_order_payment>*</to_order_payment>
34
+ </file_check>
35
+ </sales_convert_quote_payment>
36
+ </fieldsets>
37
+ <models>
38
+ <scancheck>
39
+ <class>Magebuzz_Scancheck_Model</class>
40
+ <resourceModel>scancheck_mysql4</resourceModel>
41
+ </scancheck>
42
+ <scancheck_mysql4>
43
+ <class>Magebuzz_Scancheck_Model_Mysql4</class>
44
+ <entities>
45
+ <scancheck>
46
+ <table>scancheck</table>
47
+ </scancheck>
48
+ <sales_quote_payment_file>
49
+ <table>sales_quote_payment_file</table>
50
+ </sales_quote_payment_file>
51
+ <sales_order_payment_file>
52
+ <table>sales_order_payment_file</table>
53
+ </sales_order_payment_file>
54
+ </entities>
55
+ </scancheck_mysql4>
56
+ </models>
57
+ <resources>
58
+ <scancheck_setup>
59
+ <setup>
60
+ <module>Magebuzz_Scancheck</module>
61
+ </setup>
62
+ <connection>
63
+ <use>core_setup</use>
64
+ </connection>
65
+ </scancheck_setup>
66
+ <scancheck_write>
67
+ <connection>
68
+ <use>core_write</use>
69
+ </connection>
70
+ </scancheck_write>
71
+ <scancheck_read>
72
+ <connection>
73
+ <use>core_read</use>
74
+ </connection>
75
+ </scancheck_read>
76
+ </resources>
77
+ <blocks>
78
+ <scancheck>
79
+ <class>Magebuzz_Scancheck_Block</class>
80
+ </scancheck>
81
+ </blocks>
82
+ <helpers>
83
+ <scancheck>
84
+ <class>Magebuzz_Scancheck_Helper</class>
85
+ </scancheck>
86
+ </helpers>
87
+ <events>
88
+ <sales_quote_save_after>
89
+ <observers>
90
+ <sales_quote_save_after>
91
+ <type>singleton</type>
92
+ <class>Magebuzz_Scancheck_Model_Observer</class>
93
+ <method>saveQuoteAfter</method>
94
+ </sales_quote_save_after>
95
+ </observers>
96
+ </sales_quote_save_after>
97
+ <checkout_submit_all_after>
98
+ <observers>
99
+ <save_after>
100
+ <type>singleton</type>
101
+ <class>Magebuzz_Scancheck_Model_Observer</class>
102
+ <method>placeOrderAfter</method>
103
+ </save_after>
104
+ </observers>
105
+ </checkout_submit_all_after>
106
+ </events>
107
+ <template>
108
+ <email>
109
+ <payment_scancheck_email_admin_template translate="label" module="scancheck">
110
+ <label>Payment File Scanned</label>
111
+ <file>paymentfile.html</file>
112
+ <type>html</type>
113
+ </payment_scancheck_email_admin_template>
114
+ </email>
115
+ </template>
116
+ </global>
117
+ <default>
118
+ <payment>
119
+ <scancheck>
120
+ <active>1</active>
121
+ <model>scancheck/scancheck</model>
122
+ <order_status>pending</order_status>
123
+ <title>Scanned Check</title>
124
+ <mailing_address>hello@example.com</mailing_address>
125
+ <email_admin_template>payment_scancheck_email_admin_template</email_admin_template>
126
+ </scancheck>
127
+ </payment>
128
+ </default>
129
+ <translate>
130
+ <modules>
131
+ <Magebuzz_Scancheck>
132
+ <files>
133
+ <default>Magebuzz_Scancheck.csv</default>
134
+ </files>
135
+ </Magebuzz_Scancheck>
136
+ </modules>
137
+ </translate>
138
+ </config>
app/code/community/Magebuzz/Scancheck/etc/system.xml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <scancheck translate="label" module="scancheck">
7
+ <label>Scanned Check</label>
8
+ <sort_order>700</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ <fields>
13
+ <active translate="label">
14
+ <label>Enabled</label>
15
+ <frontend_type>select</frontend_type>
16
+ <source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>0</show_in_store>
21
+ </active>
22
+ <title translate="label">
23
+ <label>Title</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>10</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </title>
30
+ <order_status translate="label">
31
+ <label>New Order Status</label>
32
+ <frontend_type>select</frontend_type>
33
+ <source_model>adminhtml/system_config_source_order_status_new</source_model>
34
+ <sort_order>20</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>0</show_in_store>
38
+ </order_status>
39
+ <mailing_address translate="label">
40
+ <label>Send Email To</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>32</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </mailing_address>
47
+ <email_admin_sender translate="label comment">
48
+ <label>Admin Email Sender</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_email_identity</source_model>
51
+ <sort_order>40</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </email_admin_sender>
56
+ <email_admin_template translate="label comment">
57
+ <label>Admin Email Template</label>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>adminhtml/system_config_source_email_template</source_model>
60
+ <sort_order>50</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </email_admin_template>
65
+ </fields>
66
+ </scancheck>
67
+ </groups>
68
+ </payment>
69
+ </sections>
70
+ </config>
app/code/community/Magebuzz/Scancheck/sql/scancheck_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+ $installer->run("
6
+
7
+ ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `file_check` VARCHAR( 255 ) NOT NULL ;
8
+
9
+ ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `file_check` VARCHAR( 255 ) NOT NULL ;
10
+
11
+ ");
12
+ $installer->endSetup();
app/code/community/Magebuzz/Scancheck/sql/scancheck_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+ $installer->run("
6
+
7
+ DROP TABLE IF EXISTS {$this->getTable('sales_quote_payment_file')};
8
+ CREATE TABLE {$this->getTable('sales_quote_payment_file')} (
9
+ `id` int(11) unsigned NOT NULL auto_increment,
10
+ `quote_id` varchar(255) NOT NULL default '',
11
+ `filename` varchar(255) NOT NULL default '',
12
+ `type` varchar(255) NOT NULL default '',
13
+ PRIMARY KEY (`id`)
14
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
15
+
16
+ DROP TABLE IF EXISTS {$this->getTable('sales_order_payment_file')};
17
+ CREATE TABLE {$this->getTable('sales_order_payment_file')} (
18
+ `id` int(11) unsigned NOT NULL auto_increment,
19
+ `order_id` varchar(255) NOT NULL default '',
20
+ `filename` varchar(255) NOT NULL default '',
21
+ `type` varchar(255) NOT NULL default '',
22
+ PRIMARY KEY (`id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
24
+
25
+ ");
26
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/scancheck.xml ADDED
@@ -0,0 +1 @@
 
1
+ <?xml version="1.0"?>
app/design/adminhtml/default/default/template/scancheck/order.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <div class="box-left">
3
+ <div class="entry-edit">
4
+ <div class="entry-edit-head">
5
+ <h4 class="icon-head head-account"><?php echo Mage::helper('sales')->__('Files Uploaded') ?></h4>
6
+ </div>
7
+ <div class="fieldset">
8
+ <table cellspacing="0" class="form-list">
9
+ <?php
10
+ $files = Mage::getModel('scancheck/order')->getFiles($_order);
11
+ foreach($files as $file){
12
+ ?>
13
+ <tr>
14
+ <td style="width:20%" class="label"><strong><?php echo Mage::helper('file')->__($file['type']) ?></strong></td>
15
+ <td align="right" class="value"><a target="_blank" href='<?php $url = $this->getBaseUrl().'media/uploads'.$file['filename']; echo str_replace('index.php/', '', $url); ?>'><?php echo $file['filename'];?></a></td>
16
+ </tr>
17
+ <?php } ?>
18
+ </table>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <div class="clear"></div>
app/design/adminhtml/default/default/template/scancheck/sales/order/info.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?>
2
+ <?php $order = $this->getInfo()->getOrder(); ?>
3
+ <?php $files = Mage::getModel('scancheck/order')->getFiles($order);?>
4
+ <p>
5
+ <label><?php echo $this->__('File Uploaded:')?></label>
6
+ <?php foreach($files as $file):?>
7
+ <a target="_blank" href='<?php $url = $this->getBaseUrl().'media/uploads'.$file['filename']; echo str_replace('index.php/', '', $url); ?>'><?php echo basename($file['filename']);?></a>
8
+ <?php endforeach;?>
9
+ </p>
app/design/frontend/base/default/layout/scancheck.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <checkout_onepage_index>
6
+ <reference name='head'>
7
+ <action method="addCss"><stylesheet>css/magebuzz/scancheck.css</stylesheet></action>
8
+ <action method="addItem"><type>skin_js</type><name>uploadfile/jquery-1.4.2.min.js</name></action>
9
+ <action method="addItem"><type>skin_js</type><name>uploadfile/noconflict.js</name></action>
10
+ <action method="addItem"><type>skin_js</type><name>uploadfile/jquery.uploadify.v2.1.4.js</name></action>
11
+ <action method="addItem"><type>skin_js</type><name>uploadfile/swfobject.js</name></action>
12
+ </reference>
13
+ </checkout_onepage_index>
14
+ </layout>
app/design/frontend/base/default/template/scancheck/form/upload.phtml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
3
+ <li>
4
+ <label for="<?php echo $_code ?>_file_check" class="required"><em>*</em><?php echo $this->__('Upload a scanned check now') ?></label>
5
+ <p id='file_upload_text'></p>
6
+ <div class="input-box">
7
+ <input type="file" title="<?php echo $this->__('Upload a scanned check now') ?>" class="input-text required-entry" id="<?php echo $_code ?>_file_check" name="payment[file_check]" value="<?php echo $this->htmlEscape($this->getInfoData('file_upload_path')) ?>" />
8
+ <input id="file_upload_path" type="hidden" name="file_upload_path" class='required-entry' />
9
+ <input type="hidden" value='payment_file' name="file_upload_type" class='required-entry' />
10
+ </div>
11
+ </li>
12
+ </ul>
13
+ <script type="text/javascript">
14
+ // <![CDATA[
15
+ jQuery(document).ready(function() {
16
+ jQuery('#<?php echo $_code ?>_file_check').uploadify({
17
+ 'uploader' : '<?php echo $this->getSkinUrl('uploadfile/uploadify.swf') ?>',
18
+ 'cancelImg' : '<?php echo $this->getSkinUrl('uploadfile/cancel.png') ?>',
19
+ 'script' : '<?php echo $this->getUrl('scancheck/index/upload') ?>',
20
+ 'auto' : true,
21
+ 'fileDataName' : 'file',
22
+ 'fileExt' : '*.jpg;*.gif;*.png',
23
+ 'fileDesc' : 'Image Files',
24
+ 'onComplete' : function(event, ID, fileObj, response, data){
25
+ jQuery('#file_upload_path').val(response);
26
+ jQuery('#file_upload_text').html('File Uploaded: '+fileObj.name);
27
+ }
28
+
29
+ });
30
+ });
31
+ // ]]>
32
+ </script>
app/design/frontend/base/default/template/scancheck/info.phtml ADDED
@@ -0,0 +1 @@
 
1
+ <p><?php echo $this->htmlEscape($this->getMethod()->getTitle()) ?></p>
app/etc/modules/Magebuzz_Info.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magebuzz_Info>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magebuzz_Info>
8
+ </modules>
9
+ </config>
app/etc/modules/Magebuzz_Scancheck.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magebuzz_Scancheck>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Magebuzz_Scancheck>
8
+ </modules>
9
+ </config>
app/locale/en_US/template/email/paymentfile.html ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--@subject Payment Scanned Check File@-->
2
+ <!--@vars
3
+ {"var data.name":"Sender Name",
4
+ "var data.email":"Sender Email",
5
+ "var data.telephone":"Sender Telephone",
6
+ "var data.comment":"Comment"}
7
+ @-->
8
+ <h2 style="font-size:18px; font-weight:normal; margin:0;">Order #{{var increment_id}} <small>(placed on {{var place_order_time}})</small></h2><br/>
9
+ <div class="info">
10
+ <strong>Order placed by:</strong><label>{{var customer_name}}</label><br/>
11
+ <strong>File Attach:</strong><a href="{{var file_attach_url}}">{{var file_attach_url}}</a><br/>
12
+ </div>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>upload_check_payment_method</name>
4
+ <version>0.1.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This Free extension adds a new payment method to your Magento store. It is quite similar to Check / Money Order, but allows customers to upload a scanned check as payment proof.</summary>
10
+ <description>This Free extension adds a new payment method to your Magento store. It is quite similar to Check / Money Order, but allows customers to upload a scanned check as payment proof.</description>
11
+ <notes>Upload check payment method</notes>
12
+ <authors><author><name>Magebuzz</name><user>magebuzz</user><email>magebuzz@gmail.com</email></author></authors>
13
+ <date>2014-07-11</date>
14
+ <time>03:08:18</time>
15
+ <contents><target name="magecommunity"><dir name="Magebuzz"><dir name="Scancheck"><dir name="Block"><dir name="Form"><file name="Upload.php" hash="1d53ab61ffb5d9c55977667f5428739c"/></dir><dir name="Info"><file name="Upload.php" hash="a01a4b4d9bf73a36933691c86500716d"/></dir></dir><dir name="Helper"><file name="Data.php" hash="5db931bae130ef95a243d8c6159e42dd"/></dir><dir name="Model"><file name="File.php" hash="5bfbd387b029d0fdd5718856502551d0"/><dir name="Mysql4"><dir name="File"><file name="Collection.php" hash="65f07bc91a646e5fc619224de3e6552e"/></dir><file name="File.php" hash="c5ad90285e9cbcb6c277ed4b8902b8c7"/><dir name="Order"><file name="Collection.php" hash="226028f3eaf7d4f12bc18d8b1380435f"/></dir><file name="Order.php" hash="42cd24cd11ba8f09e2f56d66c049ecbd"/></dir><file name="Observer.php" hash="bad96c726f130bc394ddc62ebbe3506b"/><file name="Order.php" hash="9433db84f4827184d0a6827ac68e3e7f"/><file name="Scancheck.php" hash="50956df7b4dcfb49c13b1d065594a2d5"/></dir><dir name="controllers"><file name="IndexController.php" hash="9d365a4994c3dc5361b4ee1aa2311e0e"/></dir><dir name="etc"><file name="config.xml" hash="033a8bc009dd48a715cadbb722202b3d"/><file name="system.xml" hash="d1a65175e2db5aad9cbd1e28fc4c42b0"/></dir><dir name="sql"><dir name="scancheck_setup"><file name="mysql4-install-0.1.0.php" hash="da9293274b5136a264ea00bcee2ca4e8"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="1a42ff29eb0fd362c6796f9fb05ac5d1"/></dir></dir></dir><dir name="Info"><dir name="Block"><dir name="System"><dir name="Config"><file name="Extensions (2).php" hash="aa5773e8b5dc6a33b9d4cc1154fbb69d"/><file name="Extensions.php" hash="aa5773e8b5dc6a33b9d4cc1154fbb69d"/><file name="General.php" hash="2cbe45ec38e2fc090141d0df421bed6e"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7582d16054340a767e7ed5190e71b0ad"/></dir><dir name="Model"><file name="Feed.php" hash="aa72a9d25541f123978c8598af191274"/></dir><dir name="etc"><file name="adminhtml.xml" hash="4f60efb5ce51a052113a0e895c925fbc"/><file name="config.xml" hash="bc04f45fa0580e0f26a611e14fc2ca74"/><file name="system.xml" hash="ea315b0f9ca775ce9d11e373ba50d6d2"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="scancheck.xml" hash="4922c38f0cd69f1574c4b7ba03bd9871"/></dir><dir name="template"><dir name="scancheck"><dir name="form"><file name="upload.phtml" hash="f91336816b5509d6caf3da22d6e51ce4"/></dir><file name="info.phtml" hash="6748faa7487a4e2281154c271cb8925a"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="scancheck.xml" hash="e4e345519e2b76863647d3351ace49e0"/></dir><dir name="template"><dir name="scancheck"><file name="order.phtml" hash="4f680fd60cc1589070b0c85c5223c99f"/><dir name="sales"><dir name="order"><file name="info.phtml" hash="4020e38b5cf70e4a30e7ae3c42fbb294"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magebuzz_Scancheck.xml" hash="648adf8d7e41d0593a7a63c9285bdff8"/><file name="Magebuzz_Info.xml" hash="81abb2ad3ff3428ae5b3b7c5aa04b937"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="magebuzz"><file name="scancheck.css" hash="b9a4dffadf29f3adf32aafdd111a4a39"/></dir></dir><dir name="uploadfile"><file name="cancel.png" hash="f7aec314e1916bf12a46caf55ea947ac"/><file name="check.php" hash="9fd224a7ccb88540bd253281486e881f"/><dir name="com"><dir name="adobe"><dir name="air"><dir name="logging"><file name="FileTarget.as" hash="ec3643b4ddb32b2d2ebc1f7d55c91ced"/></dir></dir><dir name="crypto"><file name="HMAC.as" hash="b9f33bcb735cb785b9e775137d2deb02"/><file name="MD5.as" hash="1332bdd143ffc7dfdbbaebf62f9aefb4"/><file name="MD5Stream.as" hash="f4931ddcde14c576028fcf23bd5d6ec1"/><file name="SHA1.as" hash="4d7fc01a79e33b1cba4eb2db458066fa"/><file name="SHA224.as" hash="ffd1adfd41a1f3c0a3a809ce304a4f5f"/><file name="SHA256.as" hash="253e9c4af7c9758652afac59287f3bc5"/><file name="WSSEUsernameToken.as" hash="ad5a856f37719af41922bb0c121e9a1b"/></dir><dir name="errors"><file name="IllegalStateError.as" hash="3511c005da6d65bc1f802efef7e268fe"/></dir><dir name="fileformats"><dir name="vcard"><file name="Address.as" hash="442aedd116b6921583386b83831a4efb"/><file name="Email.as" hash="ce884e74d76af5dbc99fd6d41508cfe8"/><file name="Phone.as" hash="56e43b5be95f7e2b78472da6a114cfea"/><file name="VCard.as" hash="48787531679efd0ed5818975a0fceb44"/><file name="VCardParser.as" hash="2b2edb82fffacefdc1b930ae0d1d8448"/></dir></dir><dir name="images"><file name="BitString.as" hash="0c434962bc86c7d528daffe4f2d67077"/><file name="JPGEncoder.as" hash="4efd4e3ae263119a0f2773d3bc4a219b"/><file name="PNGEncoder.as" hash="3091aba441141b410f95311d0c056fbb"/></dir><dir name="net"><file name="DynamicURLLoader.as" hash="48ab59e38522d8db744a8f9d0828d8cd"/><file name="IURIResolver.as" hash="58c14ad7e1d0eaa8a152b886108951f4"/><file name="MimeTypeMap.as" hash="61a17a293b6d72e763a4af64206d4b3f"/><file name="URI.as" hash="66c9d8345cedb13ebbd8c53610355dc7"/><file name="URIEncodingBitmap.as" hash="f447c72f5d7bc827317f9d81acaa9d4d"/><dir name="proxies"><file name="RFC2817Socket.as" hash="7d508d055049655cb3fdc51438d86446"/></dir></dir><dir name="protocols"><dir name="dict"><file name="Database.as" hash="b7a9f77b04cf8a84a7ec08b4c9c95f18"/><file name="Definition.as" hash="f23348cf2dbd6f9f1c08784aada623c0"/><file name="Dict.as" hash="5f679d4ee1110eb32d04fadf86fcd963"/><file name="DictionaryServer.as" hash="9bc9e6c8b4559b9d47d1106f0f9aff3e"/><file name="MatchStrategy.as" hash="dd7cd19dda9a6aead5f12d6bb5645222"/><file name="Response.as" hash="a5d1e834cbefb8516b362e37f2655e8b"/><dir name="events"><file name="ConnectedEvent.as" hash="d39fba30d2f540dedc60575141f1588d"/><file name="DatabaseEvent.as" hash="cc66ad6f3dba70980dbde9f4925e33aa"/><file name="DefinitionEvent.as" hash="6b1d74340d3c1754005f01059ec9a0ca"/><file name="DefinitionHeaderEvent.as" hash="496e4c0a8e2aee76ecd57914291e44e3"/><file name="DictionaryServerEvent.as" hash="51547bc5ab6e6687f61cb4dcf91ee625"/><file name="DisconnectedEvent.as" hash="429c99d96a6b1795994b6ac0ee5f8fc4"/><file name="ErrorEvent.as" hash="0f5a3603d3031c7f441251cb17cd9ce4"/><file name="MatchEvent.as" hash="f6f1543eb03ede469b43cff0980a2a33"/><file name="MatchStrategiesEvent.as" hash="44bebe3f7ab66cc2200329f5bf726684"/><file name="NoMatchEvent.as" hash="3df0110ea24f1bab4627a504a94fe56c"/></dir><dir name="util"><file name="CompleteResponseEvent.as" hash="7929dd2f7c63a5e12ed603dcc0f5bd88"/><file name="SocketHelper.as" hash="040301b1a229316028eececfbb6f9664"/></dir></dir></dir><dir name="serialization"><dir name="json"><file name="JSON.as" hash="2d5d3261b2d396127a861d771b506feb"/><file name="JSONDecoder.as" hash="4adb46e2f6f82c7ad2ddb2102c947397"/><file name="JSONEncoder.as" hash="f2802c0025547d37081a1eb92b604375"/><file name="JSONParseError.as" hash="349b4a6caceeb46730e01e909cc08413"/><file name="JSONToken.as" hash="1306bd9a6d3ccb468510b068fd7bddbf"/><file name="JSONTokenType.as" hash="26dd8b36a591c987d053b4845719af7b"/><file name="JSONTokenizer.as" hash="c150c00d14494dd405cc1ace240312f0"/></dir></dir><dir name="utils"><file name="ArrayUtil.as" hash="99a9bf2faccdde75cb022edeb29117f2"/><file name="DateUtil.as" hash="0e7a4c4e21c625082da01a156d07bfaf"/><file name="DictionaryUtil.as" hash="5396745afdc7b6f2ceeb6848fb285bf2"/><file name="IntUtil.as" hash="8ff3c295004e20d71fbdf1e3cb3c18f9"/><file name="NumberFormatter.as" hash="51b00659d4dfdb94dc7f8346b703c670"/><file name="StringUtil.as" hash="68e78183b17db17eb4af4d839dbb78e1"/><file name="XMLUtil.as" hash="e7d431a8faace3c7cc260350badb6551"/></dir><dir name="webapis"><file name="ServiceBase.as" hash="65f58905504330880a8419d0932f2e18"/><file name="URLLoaderBase.as" hash="ade390b4d7b27cd070bed1d19493cfc5"/><dir name="events"><file name="ServiceEvent.as" hash="3fda6d0eb0260905ef7d5a0d58e25b29"/></dir></dir></dir></dir><file name="expressInstall.swf" hash="7b65fbfaec8b2955090389af60646e8b"/><file name="jquery-1.4.2.min.js" hash="65b352e1ba79f0e2a3b1e014bc2571af"/><file name="jquery.uploadify.v2.1.4.js" hash="6041f3ba7f95f23cac27cdb22ecd0e62"/><file name="jquery.uploadify.v2.1.4.min.js" hash="3f52c03db64abc53ec2e6d5ef2dcb519"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/><file name="swfobject.js" hash="892a543f3abb54e8ec1ada55be3b0649"/><file name="uploadify.allglyphs.swf" hash="bd1ef2b77dbf8ec7ddfe1f0d256d1e6a"/><file name="uploadify.css" hash="bc1c001d1a36e0bcd6d0220f08828bf4"/><file name="uploadify.fla" hash="dea3279f2f0240281cd27e2c05d19d31"/><file name="uploadify.php" hash="aa9e52c4057da9d14f0fba7754b0deca"/><file name="uploadify.swf" hash="4dda0e509f6866c677f7b0f445b26718"/></dir></dir></dir></dir></target><target name="mage"><dir name="app"><dir name="locale"><dir name="en_US"><dir name="template"><dir name="email"><file name="paymentfile.html" hash="e368cb110fd3b373c996c548fc0b5d46"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/frontend/base/default/css/magebuzz/scancheck.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ #payment_form_scancheck{}
2
+ #file_upload_text{float:left; width:100%; margin:5px 0;}
3
+ #scancheck_file_check{}
skin/frontend/base/default/uploadfile/cancel.png ADDED
Binary file
skin/frontend/base/default/uploadfile/check.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Uploadify v2.1.4
4
+ Release Date: November 8, 2010
5
+
6
+ Copyright (c) 2010 Ronnie Garcia, Travis Nickels
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ */
26
+ $fileArray = array();
27
+ foreach ($_POST as $key => $value) {
28
+ if ($key != 'folder') {
29
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
30
+ $fileArray[$key] = $value;
31
+ }
32
+ }
33
+ }
34
+ echo json_encode($fileArray);
35
+ ?>
skin/frontend/base/default/uploadfile/com/adobe/air/logging/FileTarget.as ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.air.logging
34
+ {
35
+ import mx.logging.AbstractTarget;
36
+ import flash.filesystem.File;
37
+ import flash.filesystem.FileStream;
38
+ import flash.filesystem.FileMode;
39
+ import mx.logging.LogEvent;
40
+ import flash.system.System;
41
+ import flash.system.Capabilities;
42
+ import mx.logging.targets.LineFormattedTarget;
43
+ import mx.core.mx_internal;
44
+
45
+ use namespace mx_internal;
46
+
47
+ /**
48
+ * An Adobe AIR only class that provides a log target for the Flex logging
49
+ * framework, that logs files to a file on the user's system.
50
+ *
51
+ * This class will only work when running within Adobe AIR>
52
+ */
53
+ public class FileTarget extends LineFormattedTarget
54
+ {
55
+ private const DEFAULT_LOG_PATH:String = "app-storage:/application.log";
56
+
57
+ private var log:File;
58
+
59
+ public function FileTarget(logFile:File = null)
60
+ {
61
+ if(logFile != null)
62
+ {
63
+ log = logFile;
64
+ }
65
+ else
66
+ {
67
+ log = new File(DEFAULT_LOG_PATH);
68
+ }
69
+ }
70
+
71
+ public function get logURI():String
72
+ {
73
+ return log.url;
74
+ }
75
+
76
+ mx_internal override function internalLog(message:String):void
77
+ {
78
+ write(message);
79
+ }
80
+
81
+ private function write(msg:String):void
82
+ {
83
+ var fs:FileStream = new FileStream();
84
+ fs.open(log, FileMode.APPEND);
85
+ fs.writeUTFBytes(msg + "\n");
86
+ fs.close();
87
+ }
88
+
89
+ public function clear():void
90
+ {
91
+ var fs:FileStream = new FileStream();
92
+ fs.open(log, FileMode.WRITE);
93
+ fs.writeUTFBytes("");
94
+ fs.close();
95
+ }
96
+
97
+ }
98
+ }
skin/frontend/base/default/uploadfile/com/adobe/crypto/HMAC.as ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.crypto {
34
+ import flash.utils.ByteArray;
35
+ import flash.utils.Endian;
36
+ import flash.utils.describeType;
37
+ /**
38
+ * Keyed-Hashing for Message Authentication
39
+ * Implementation based on algorithm description at
40
+ * http://www.faqs.org/rfcs/rfc2104.html
41
+ */
42
+ public class HMAC
43
+ {
44
+ /**
45
+ * Performs the HMAC hash algorithm using byte arrays.
46
+ *
47
+ * @param secret The secret key
48
+ * @param message The message to hash
49
+ * @param algorithm Hash object to use
50
+ * @return A string containing the hash value of message
51
+ * @langversion ActionScript 3.0
52
+ * @playerversion Flash 8.5
53
+ * @tiptext
54
+ */
55
+ public static function hash( secret:String, message:String, algorithm:Object = null ):String
56
+ {
57
+ var text:ByteArray = new ByteArray();
58
+ var k_secret:ByteArray = new ByteArray();
59
+
60
+ text.writeUTFBytes(message);
61
+ k_secret.writeUTFBytes(secret);
62
+
63
+ return hashBytes(k_secret, text, algorithm);
64
+ }
65
+
66
+ /**
67
+ * Performs the HMAC hash algorithm using string.
68
+ *
69
+ * @param secret The secret key
70
+ * @param message The message to hash
71
+ * @param algorithm Hash object to use
72
+ * @return A string containing the hash value of message
73
+ * @langversion ActionScript 3.0
74
+ * @playerversion Flash 8.5
75
+ * @tiptext
76
+ */
77
+ public static function hashBytes( secret:ByteArray, message:ByteArray, algorithm:Object = null ):String
78
+ {
79
+ var ipad:ByteArray = new ByteArray();
80
+ var opad:ByteArray = new ByteArray();
81
+ var endian:String = Endian.BIG_ENDIAN;
82
+
83
+ if(algorithm == null){
84
+ algorithm = MD5;
85
+ }
86
+
87
+ if ( describeType(algorithm).@name.toString() == "com.adobe.crypto::MD5" ) {
88
+ endian = Endian.LITTLE_ENDIAN;
89
+ }
90
+
91
+ if ( secret.length > 64 ) {
92
+ algorithm.hashBytes(secret);
93
+ secret = new ByteArray();
94
+ secret.endian = endian;
95
+
96
+ while ( algorithm.digest.bytesAvailable != 0 ) {
97
+ secret.writeInt(algorithm.digest.readInt());
98
+ }
99
+ }
100
+
101
+ secret.length = 64
102
+ secret.position = 0;
103
+ for ( var x:int = 0; x < 64; x++ ) {
104
+ var byte:int = secret.readByte();
105
+ ipad.writeByte(0x36 ^ byte);
106
+ opad.writeByte(0x5c ^ byte);
107
+ }
108
+
109
+ ipad.writeBytes(message);
110
+ algorithm.hashBytes(ipad);
111
+ var tmp:ByteArray = new ByteArray();
112
+ tmp.endian = endian;
113
+
114
+ while ( algorithm.digest.bytesAvailable != 0 ) {
115
+ tmp.writeInt(algorithm.digest.readInt());
116
+ }
117
+ tmp.position = 0;
118
+
119
+ while ( tmp.bytesAvailable != 0 ) {
120
+ opad.writeByte(tmp.readUnsignedByte());
121
+ }
122
+ return algorithm.hashBytes( opad );
123
+ }
124
+
125
+ }
126
+
127
+ }
skin/frontend/base/default/uploadfile/com/adobe/crypto/MD5.as ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.crypto {
34
+
35
+ import com.adobe.utils.IntUtil;
36
+ import flash.utils.ByteArray;
37
+ /**
38
+ * The MD5 Message-Digest Algorithm
39
+ *
40
+ * Implementation based on algorithm description at
41
+ * http://www.faqs.org/rfcs/rfc1321.html
42
+ */
43
+ public class MD5 {
44
+
45
+ public static var digest:ByteArray;
46
+ /**
47
+ * Performs the MD5 hash algorithm on a string.
48
+ *
49
+ * @param s The string to hash
50
+ * @return A string containing the hash value of s
51
+ * @langversion ActionScript 3.0
52
+ * @playerversion Flash 8.5
53
+ * @tiptext
54
+ */
55
+
56
+ public static function hash(s:String) :String{
57
+ //Convert to byteArray and send through hashBinary function
58
+ // so as to only have complex code in one location
59
+ var ba:ByteArray = new ByteArray();
60
+ ba.writeUTFBytes(s);
61
+ return hashBinary(ba);
62
+ }
63
+
64
+ public static function hashBytes(s:ByteArray) :String{
65
+ return hashBinary(s);
66
+ }
67
+
68
+ /**
69
+ * Performs the MD5 hash algorithm on a ByteArray.
70
+ *
71
+ * @param s The string to hash
72
+ * @return A string containing the hash value of s
73
+ * @langversion ActionScript 3.0
74
+ * @playerversion Flash 8.5
75
+ * @tiptext
76
+ */
77
+ public static function hashBinary( s:ByteArray ):String {
78
+ // initialize the md buffers
79
+ var a:int = 1732584193;
80
+ var b:int = -271733879;
81
+ var c:int = -1732584194;
82
+ var d:int = 271733878;
83
+
84
+ // variables to store previous values
85
+ var aa:int;
86
+ var bb:int;
87
+ var cc:int;
88
+ var dd:int;
89
+
90
+ // create the blocks from the string and
91
+ // save the length as a local var to reduce
92
+ // lookup in the loop below
93
+ var x:Array = createBlocks( s );
94
+ var len:int = x.length;
95
+
96
+ // loop over all of the blocks
97
+ for ( var i:int = 0; i < len; i += 16) {
98
+ // save previous values
99
+ aa = a;
100
+ bb = b;
101
+ cc = c;
102
+ dd = d;
103
+
104
+ // Round 1
105
+ a = ff( a, b, c, d, x[int(i+ 0)], 7, -680876936 ); // 1
106
+ d = ff( d, a, b, c, x[int(i+ 1)], 12, -389564586 ); // 2
107
+ c = ff( c, d, a, b, x[int(i+ 2)], 17, 606105819 ); // 3
108
+ b = ff( b, c, d, a, x[int(i+ 3)], 22, -1044525330 ); // 4
109
+ a = ff( a, b, c, d, x[int(i+ 4)], 7, -176418897 ); // 5
110
+ d = ff( d, a, b, c, x[int(i+ 5)], 12, 1200080426 ); // 6
111
+ c = ff( c, d, a, b, x[int(i+ 6)], 17, -1473231341 ); // 7
112
+ b = ff( b, c, d, a, x[int(i+ 7)], 22, -45705983 ); // 8
113
+ a = ff( a, b, c, d, x[int(i+ 8)], 7, 1770035416 ); // 9
114
+ d = ff( d, a, b, c, x[int(i+ 9)], 12, -1958414417 ); // 10
115
+ c = ff( c, d, a, b, x[int(i+10)], 17, -42063 ); // 11
116
+ b = ff( b, c, d, a, x[int(i+11)], 22, -1990404162 ); // 12
117
+ a = ff( a, b, c, d, x[int(i+12)], 7, 1804603682 ); // 13
118
+ d = ff( d, a, b, c, x[int(i+13)], 12, -40341101 ); // 14
119
+ c = ff( c, d, a, b, x[int(i+14)], 17, -1502002290 ); // 15
120
+ b = ff( b, c, d, a, x[int(i+15)], 22, 1236535329 ); // 16
121
+
122
+ // Round 2
123
+ a = gg( a, b, c, d, x[int(i+ 1)], 5, -165796510 ); // 17
124
+ d = gg( d, a, b, c, x[int(i+ 6)], 9, -1069501632 ); // 18
125
+ c = gg( c, d, a, b, x[int(i+11)], 14, 643717713 ); // 19
126
+ b = gg( b, c, d, a, x[int(i+ 0)], 20, -373897302 ); // 20
127
+ a = gg( a, b, c, d, x[int(i+ 5)], 5, -701558691 ); // 21
128
+ d = gg( d, a, b, c, x[int(i+10)], 9, 38016083 ); // 22
129
+ c = gg( c, d, a, b, x[int(i+15)], 14, -660478335 ); // 23
130
+ b = gg( b, c, d, a, x[int(i+ 4)], 20, -405537848 ); // 24
131
+ a = gg( a, b, c, d, x[int(i+ 9)], 5, 568446438 ); // 25
132
+ d = gg( d, a, b, c, x[int(i+14)], 9, -1019803690 ); // 26
133
+ c = gg( c, d, a, b, x[int(i+ 3)], 14, -187363961 ); // 27
134
+ b = gg( b, c, d, a, x[int(i+ 8)], 20, 1163531501 ); // 28
135
+ a = gg( a, b, c, d, x[int(i+13)], 5, -1444681467 ); // 29
136
+ d = gg( d, a, b, c, x[int(i+ 2)], 9, -51403784 ); // 30
137
+ c = gg( c, d, a, b, x[int(i+ 7)], 14, 1735328473 ); // 31
138
+ b = gg( b, c, d, a, x[int(i+12)], 20, -1926607734 ); // 32
139
+
140
+ // Round 3
141
+ a = hh( a, b, c, d, x[int(i+ 5)], 4, -378558 ); // 33
142
+ d = hh( d, a, b, c, x[int(i+ 8)], 11, -2022574463 ); // 34
143
+ c = hh( c, d, a, b, x[int(i+11)], 16, 1839030562 ); // 35
144
+ b = hh( b, c, d, a, x[int(i+14)], 23, -35309556 ); // 36
145
+ a = hh( a, b, c, d, x[int(i+ 1)], 4, -1530992060 ); // 37
146
+ d = hh( d, a, b, c, x[int(i+ 4)], 11, 1272893353 ); // 38
147
+ c = hh( c, d, a, b, x[int(i+ 7)], 16, -155497632 ); // 39
148
+ b = hh( b, c, d, a, x[int(i+10)], 23, -1094730640 ); // 40
149
+ a = hh( a, b, c, d, x[int(i+13)], 4, 681279174 ); // 41
150
+ d = hh( d, a, b, c, x[int(i+ 0)], 11, -358537222 ); // 42
151
+ c = hh( c, d, a, b, x[int(i+ 3)], 16, -722521979 ); // 43
152
+ b = hh( b, c, d, a, x[int(i+ 6)], 23, 76029189 ); // 44
153
+ a = hh( a, b, c, d, x[int(i+ 9)], 4, -640364487 ); // 45
154
+ d = hh( d, a, b, c, x[int(i+12)], 11, -421815835 ); // 46
155
+ c = hh( c, d, a, b, x[int(i+15)], 16, 530742520 ); // 47
156
+ b = hh( b, c, d, a, x[int(i+ 2)], 23, -995338651 ); // 48
157
+
158
+ // Round 4
159
+ a = ii( a, b, c, d, x[int(i+ 0)], 6, -198630844 ); // 49
160
+ d = ii( d, a, b, c, x[int(i+ 7)], 10, 1126891415 ); // 50
161
+ c = ii( c, d, a, b, x[int(i+14)], 15, -1416354905 ); // 51
162
+ b = ii( b, c, d, a, x[int(i+ 5)], 21, -57434055 ); // 52
163
+ a = ii( a, b, c, d, x[int(i+12)], 6, 1700485571 ); // 53
164
+ d = ii( d, a, b, c, x[int(i+ 3)], 10, -1894986606 ); // 54
165
+ c = ii( c, d, a, b, x[int(i+10)], 15, -1051523 ); // 55
166
+ b = ii( b, c, d, a, x[int(i+ 1)], 21, -2054922799 ); // 56
167
+ a = ii( a, b, c, d, x[int(i+ 8)], 6, 1873313359 ); // 57
168
+ d = ii( d, a, b, c, x[int(i+15)], 10, -30611744 ); // 58
169
+ c = ii( c, d, a, b, x[int(i+ 6)], 15, -1560198380 ); // 59
170
+ b = ii( b, c, d, a, x[int(i+13)], 21, 1309151649 ); // 60
171
+ a = ii( a, b, c, d, x[int(i+ 4)], 6, -145523070 ); // 61
172
+ d = ii( d, a, b, c, x[int(i+11)], 10, -1120210379 ); // 62
173
+ c = ii( c, d, a, b, x[int(i+ 2)], 15, 718787259 ); // 63
174
+ b = ii( b, c, d, a, x[int(i+ 9)], 21, -343485551 ); // 64
175
+
176
+ a += aa;
177
+ b += bb;
178
+ c += cc;
179
+ d += dd;
180
+ }
181
+ digest = new ByteArray()
182
+ digest.writeInt(a);
183
+ digest.writeInt(b);
184
+ digest.writeInt(c);
185
+ digest.writeInt(d);
186
+ digest.position = 0;
187
+ // Finish up by concatening the buffers with their hex output
188
+ return IntUtil.toHex( a ) + IntUtil.toHex( b ) + IntUtil.toHex( c ) + IntUtil.toHex( d );
189
+ }
190
+
191
+ /**
192
+ * Auxiliary function f as defined in RFC
193
+ */
194
+ private static function f( x:int, y:int, z:int ):int {
195
+ return ( x & y ) | ( (~x) & z );
196
+ }
197
+
198
+ /**
199
+ * Auxiliary function g as defined in RFC
200
+ */
201
+ private static function g( x:int, y:int, z:int ):int {
202
+ return ( x & z ) | ( y & (~z) );
203
+ }
204
+
205
+ /**
206
+ * Auxiliary function h as defined in RFC
207
+ */
208
+ private static function h( x:int, y:int, z:int ):int {
209
+ return x ^ y ^ z;
210
+ }
211
+
212
+ /**
213
+ * Auxiliary function i as defined in RFC
214
+ */
215
+ private static function i( x:int, y:int, z:int ):int {
216
+ return y ^ ( x | (~z) );
217
+ }
218
+
219
+ /**
220
+ * A generic transformation function. The logic of ff, gg, hh, and
221
+ * ii are all the same, minus the function used, so pull that logic
222
+ * out and simplify the method bodies for the transoformation functions.
223
+ */
224
+ private static function transform( func:Function, a:int, b:int, c:int, d:int, x:int, s:int, t:int):int {
225
+ var tmp:int = a + int( func( b, c, d ) ) + x + t;
226
+ return IntUtil.rol( tmp, s ) + b;
227
+ }
228
+
229
+ /**
230
+ * ff transformation function
231
+ */
232
+ private static function ff ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
233
+ return transform( f, a, b, c, d, x, s, t );
234
+ }
235
+
236
+ /**
237
+ * gg transformation function
238
+ */
239
+ private static function gg ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
240
+ return transform( g, a, b, c, d, x, s, t );
241
+ }
242
+
243
+ /**
244
+ * hh transformation function
245
+ */
246
+ private static function hh ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
247
+ return transform( h, a, b, c, d, x, s, t );
248
+ }
249
+
250
+ /**
251
+ * ii transformation function
252
+ */
253
+ private static function ii ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
254
+ return transform( i, a, b, c, d, x, s, t );
255
+ }
256
+
257
+ /**
258
+ * Converts a string to a sequence of 16-word blocks
259
+ * that we'll do the processing on. Appends padding
260
+ * and length in the process.
261
+ *
262
+ * @param s The string to split into blocks
263
+ * @return An array containing the blocks that s was
264
+ * split into.
265
+ */
266
+ private static function createBlocks( s:ByteArray ):Array {
267
+ var blocks:Array = new Array();
268
+ var len:int = s.length * 8;
269
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
270
+ for( var i:int = 0; i < len; i += 8 ) {
271
+ blocks[ int(i >> 5) ] |= ( s[ i / 8 ] & mask ) << ( i % 32 );
272
+ }
273
+
274
+ // append padding and length
275
+ blocks[ int(len >> 5) ] |= 0x80 << ( len % 32 );
276
+ blocks[ int(( ( ( len + 64 ) >>> 9 ) << 4 ) + 14) ] = len;
277
+ return blocks;
278
+ }
279
+
280
+ }
281
+ }
skin/frontend/base/default/uploadfile/com/adobe/crypto/MD5Stream.as ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.crypto
34
+ {
35
+ import com.adobe.utils.IntUtil;
36
+ import flash.utils.ByteArray;
37
+
38
+ /**
39
+ * Perform MD5 hash of an input stream in chunks. This class is
40
+ * based on com.adobe.crypto.MD5 and can process data in
41
+ * chunks. Both block creation and hash computation are done
42
+ * together for whatever input is available so that the memory
43
+ * overhead at a time is always fixed. Memory usage is governed by
44
+ * two parameters: one is the amount of data passed in to update()
45
+ * and the other is memoryBlockSize. The latter comes into play
46
+ * only when the memory window exceeds the pre allocated memory
47
+ * window of flash player. Usage: create an instance, call
48
+ * update(data) repeatedly for all chunks and finally complete()
49
+ * which will return the md5 hash.
50
+ */
51
+ public class MD5Stream
52
+ {
53
+ private static var mask:int = 0xFF;
54
+
55
+ private var arr:Array = [];
56
+
57
+ /* running count of length */
58
+ private var arrLen:int;
59
+
60
+ // initialize the md buffers
61
+ private var a:int = 1732584193;
62
+ private var b:int = -271733879;
63
+ private var c:int = -1732584194;
64
+ private var d:int = 271733878;
65
+
66
+ // variables to store previous values
67
+ private var aa:int;
68
+ private var bb:int;
69
+ private var cc:int;
70
+ private var dd:int;
71
+
72
+ /* index for data read */
73
+ private var arrIndexLen:int = 0;
74
+ /* index for hash computation */
75
+ private var arrProcessIndex:int = 0;
76
+ /* index for removing stale arr values */
77
+ private var cleanIndex:int = 0;
78
+
79
+ /**
80
+ * Change this value from the default (16384) in the range of
81
+ * MBs to actually affect GC as GC allocates in pools of
82
+ * memory */
83
+ public var memoryBlockSize:int = 16384;
84
+
85
+
86
+ public function MD5Stream()
87
+ {
88
+
89
+ }
90
+
91
+
92
+ /**
93
+ * Pass in chunks of the input data with update(), call
94
+ * complete() with an optional chunk which will return the
95
+ * final hash. Equivalent to the way
96
+ * java.security.MessageDigest works.
97
+ *
98
+ * @param input The optional bytearray chunk which is the final part of the input
99
+ * @return A string containing the hash value
100
+ * @langversion ActionScript 3.0
101
+ * @playerversion Flash 8.5
102
+ * @tiptext
103
+ */
104
+ public function complete(input:ByteArray=null):String
105
+ {
106
+ if ( arr.length == 0 )
107
+ {
108
+ if ( input == null )
109
+ {
110
+ throw new Error("null input to complete without prior call to update. At least an empty bytearray must be passed.");
111
+ }
112
+ }
113
+
114
+ if ( input != null )
115
+ {
116
+ readIntoArray(input);
117
+ }
118
+
119
+ //pad, append length
120
+ padArray(arrLen);
121
+
122
+ hashRemainingChunks(false);
123
+
124
+ var res:String = IntUtil.toHex( a ) + IntUtil.toHex( b ) +
125
+ IntUtil.toHex( c ) + IntUtil.toHex( d );
126
+ resetFields();
127
+
128
+ return res;
129
+ }
130
+
131
+ /**
132
+ * Pass in chunks of the input data with update(), call
133
+ * complete() with an optional chunk which will return the
134
+ * final hash. Equivalent to the way
135
+ * java.security.MessageDigest works.
136
+ *
137
+ * @param input The bytearray chunk to perform the hash on
138
+ * @langversion ActionScript 3.0
139
+ * @playerversion Flash 8.5
140
+ * @tiptext
141
+ */
142
+ public function update(input:ByteArray):void
143
+ {
144
+ readIntoArray(input);
145
+ hashRemainingChunks();
146
+ }
147
+
148
+ /**
149
+ * Re-initialize this instance for use to perform hashing on
150
+ * another input stream. This is called automatically by
151
+ * complete().
152
+ *
153
+ * @langversion ActionScript 3.0
154
+ * @playerversion Flash 8.5
155
+ * @tiptext
156
+ */
157
+ public function resetFields():void
158
+ {
159
+ //truncate array
160
+ arr.length = 0;
161
+ arrLen = 0;
162
+
163
+ // initialize the md buffers
164
+ a = 1732584193;
165
+ b = -271733879;
166
+ c = -1732584194;
167
+ d = 271733878;
168
+
169
+ // variables to store previous values
170
+ aa = 0;
171
+ bb = 0;
172
+ cc = 0;
173
+ dd = 0;
174
+
175
+ arrIndexLen = 0;
176
+ arrProcessIndex = 0;
177
+ cleanIndex = 0;
178
+ }
179
+
180
+ /** read into arr and free up used blocks of arr */
181
+ private function readIntoArray(input:ByteArray):void
182
+ {
183
+ var closestChunkLen:int = input.length * 8;
184
+ arrLen += closestChunkLen;
185
+
186
+ /* clean up memory. if there are entries in the array that
187
+ * are already processed and the amount is greater than
188
+ * memoryBlockSize, create a new array, copy the last
189
+ * block into it and let the old one get picked up by
190
+ * GC. */
191
+ if ( arrProcessIndex - cleanIndex > memoryBlockSize )
192
+ {
193
+ var newarr:Array= new Array();
194
+
195
+ /* AS Arrays in sparse arrays. arr[2002] can exist
196
+ * without values for arr[0] - arr[2001] */
197
+ for ( var j:int = arrProcessIndex; j < arr.length; j++ )
198
+ {
199
+ newarr[j] = arr[j];
200
+ }
201
+
202
+ cleanIndex = arrProcessIndex;
203
+ arr = null;
204
+ arr = newarr;
205
+ }
206
+
207
+ for ( var k:int = 0; k < closestChunkLen; k+=8 )
208
+ {
209
+ //discard high bytes (convert to uint)
210
+ arr[ int(arrIndexLen >> 5) ] |= ( input[ k / 8 ] & mask ) << ( arrIndexLen % 32 );
211
+ arrIndexLen += 8;
212
+ }
213
+
214
+
215
+ }
216
+
217
+ private function hashRemainingChunks(bUpdate:Boolean=true):void
218
+ {
219
+ var len:int = arr.length;
220
+
221
+ /* leave a 16 word block untouched if we are called from
222
+ * update. This is because, padArray() can modify the last
223
+ * block and this modification has to happen before we
224
+ * compute the hash. */
225
+ if ( bUpdate )
226
+ {
227
+ len -= 16;
228
+ }
229
+
230
+ /* don't do anything if don't have a 16 word block. */
231
+ if ( arrProcessIndex >= len || len - arrProcessIndex < 15 )
232
+ {
233
+ return;
234
+ }
235
+
236
+
237
+ for ( var i:int = arrProcessIndex; i < len ; i += 16, arrProcessIndex += 16)
238
+ {
239
+ // save previous values
240
+ aa = a;
241
+ bb = b;
242
+ cc = c;
243
+ dd = d;
244
+
245
+ // Round 1
246
+ a = ff( a, b, c, d, arr[int(i+ 0)], 7, -680876936 ); // 1
247
+ d = ff( d, a, b, c, arr[int(i+ 1)], 12, -389564586 ); // 2
248
+ c = ff( c, d, a, b, arr[int(i+ 2)], 17, 606105819 ); // 3
249
+ b = ff( b, c, d, a, arr[int(i+ 3)], 22, -1044525330 ); // 4
250
+ a = ff( a, b, c, d, arr[int(i+ 4)], 7, -176418897 ); // 5
251
+ d = ff( d, a, b, c, arr[int(i+ 5)], 12, 1200080426 ); // 6
252
+ c = ff( c, d, a, b, arr[int(i+ 6)], 17, -1473231341 ); // 7
253
+ b = ff( b, c, d, a, arr[int(i+ 7)], 22, -45705983 ); // 8
254
+ a = ff( a, b, c, d, arr[int(i+ 8)], 7, 1770035416 ); // 9
255
+ d = ff( d, a, b, c, arr[int(i+ 9)], 12, -1958414417 ); // 10
256
+ c = ff( c, d, a, b, arr[int(i+10)], 17, -42063 ); // 11
257
+ b = ff( b, c, d, a, arr[int(i+11)], 22, -1990404162 ); // 12
258
+ a = ff( a, b, c, d, arr[int(i+12)], 7, 1804603682 ); // 13
259
+ d = ff( d, a, b, c, arr[int(i+13)], 12, -40341101 ); // 14
260
+ c = ff( c, d, a, b, arr[int(i+14)], 17, -1502002290 ); // 15
261
+ b = ff( b, c, d, a, arr[int(i+15)], 22, 1236535329 ); // 16
262
+
263
+ // Round 2
264
+ a = gg( a, b, c, d, arr[int(i+ 1)], 5, -165796510 ); // 17
265
+ d = gg( d, a, b, c, arr[int(i+ 6)], 9, -1069501632 ); // 18
266
+ c = gg( c, d, a, b, arr[int(i+11)], 14, 643717713 ); // 19
267
+ b = gg( b, c, d, a, arr[int(i+ 0)], 20, -373897302 ); // 20
268
+ a = gg( a, b, c, d, arr[int(i+ 5)], 5, -701558691 ); // 21
269
+ d = gg( d, a, b, c, arr[int(i+10)], 9, 38016083 ); // 22
270
+ c = gg( c, d, a, b, arr[int(i+15)], 14, -660478335 ); // 23
271
+ b = gg( b, c, d, a, arr[int(i+ 4)], 20, -405537848 ); // 24
272
+ a = gg( a, b, c, d, arr[int(i+ 9)], 5, 568446438 ); // 25
273
+ d = gg( d, a, b, c, arr[int(i+14)], 9, -1019803690 ); // 26
274
+ c = gg( c, d, a, b, arr[int(i+ 3)], 14, -187363961 ); // 27
275
+ b = gg( b, c, d, a, arr[int(i+ 8)], 20, 1163531501 ); // 28
276
+ a = gg( a, b, c, d, arr[int(i+13)], 5, -1444681467 ); // 29
277
+ d = gg( d, a, b, c, arr[int(i+ 2)], 9, -51403784 ); // 30
278
+ c = gg( c, d, a, b, arr[int(i+ 7)], 14, 1735328473 ); // 31
279
+ b = gg( b, c, d, a, arr[int(i+12)], 20, -1926607734 ); // 32
280
+
281
+ // Round 3
282
+ a = hh( a, b, c, d, arr[int(i+ 5)], 4, -378558 ); // 33
283
+ d = hh( d, a, b, c, arr[int(i+ 8)], 11, -2022574463 ); // 34
284
+ c = hh( c, d, a, b, arr[int(i+11)], 16, 1839030562 ); // 35
285
+ b = hh( b, c, d, a, arr[int(i+14)], 23, -35309556 ); // 36
286
+ a = hh( a, b, c, d, arr[int(i+ 1)], 4, -1530992060 ); // 37
287
+ d = hh( d, a, b, c, arr[int(i+ 4)], 11, 1272893353 ); // 38
288
+ c = hh( c, d, a, b, arr[int(i+ 7)], 16, -155497632 ); // 39
289
+ b = hh( b, c, d, a, arr[int(i+10)], 23, -1094730640 ); // 40
290
+ a = hh( a, b, c, d, arr[int(i+13)], 4, 681279174 ); // 41
291
+ d = hh( d, a, b, c, arr[int(i+ 0)], 11, -358537222 ); // 42
292
+ c = hh( c, d, a, b, arr[int(i+ 3)], 16, -722521979 ); // 43
293
+ b = hh( b, c, d, a, arr[int(i+ 6)], 23, 76029189 ); // 44
294
+ a = hh( a, b, c, d, arr[int(i+ 9)], 4, -640364487 ); // 45
295
+ d = hh( d, a, b, c, arr[int(i+12)], 11, -421815835 ); // 46
296
+ c = hh( c, d, a, b, arr[int(i+15)], 16, 530742520 ); // 47
297
+ b = hh( b, c, d, a, arr[int(i+ 2)], 23, -995338651 ); // 48
298
+
299
+ // Round 4
300
+ a = ii( a, b, c, d, arr[int(i+ 0)], 6, -198630844 ); // 49
301
+ d = ii( d, a, b, c, arr[int(i+ 7)], 10, 1126891415 ); // 50
302
+ c = ii( c, d, a, b, arr[int(i+14)], 15, -1416354905 ); // 51
303
+ b = ii( b, c, d, a, arr[int(i+ 5)], 21, -57434055 ); // 52
304
+ a = ii( a, b, c, d, arr[int(i+12)], 6, 1700485571 ); // 53
305
+ d = ii( d, a, b, c, arr[int(i+ 3)], 10, -1894986606 ); // 54
306
+ c = ii( c, d, a, b, arr[int(i+10)], 15, -1051523 ); // 55
307
+ b = ii( b, c, d, a, arr[int(i+ 1)], 21, -2054922799 ); // 56
308
+ a = ii( a, b, c, d, arr[int(i+ 8)], 6, 1873313359 ); // 57
309
+ d = ii( d, a, b, c, arr[int(i+15)], 10, -30611744 ); // 58
310
+ c = ii( c, d, a, b, arr[int(i+ 6)], 15, -1560198380 ); // 59
311
+ b = ii( b, c, d, a, arr[int(i+13)], 21, 1309151649 ); // 60
312
+ a = ii( a, b, c, d, arr[int(i+ 4)], 6, -145523070 ); // 61
313
+ d = ii( d, a, b, c, arr[int(i+11)], 10, -1120210379 ); // 62
314
+ c = ii( c, d, a, b, arr[int(i+ 2)], 15, 718787259 ); // 63
315
+ b = ii( b, c, d, a, arr[int(i+ 9)], 21, -343485551 ); // 64
316
+
317
+ a += aa;
318
+ b += bb;
319
+ c += cc;
320
+ d += dd;
321
+
322
+ }
323
+
324
+ }
325
+
326
+ private function padArray(len:int):void
327
+ {
328
+ arr[ int(len >> 5) ] |= 0x80 << ( len % 32 );
329
+ arr[ int(( ( ( len + 64 ) >>> 9 ) << 4 ) + 14) ] = len;
330
+ arrLen = arr.length;
331
+ }
332
+
333
+ /* Code below same as com.adobe.crypto.MD5 */
334
+
335
+ /**
336
+ * Auxiliary function f as defined in RFC
337
+ */
338
+ private static function f( x:int, y:int, z:int ):int {
339
+ return ( x & y ) | ( (~x) & z );
340
+ }
341
+
342
+ /**
343
+ * Auxiliary function g as defined in RFC
344
+ */
345
+ private static function g( x:int, y:int, z:int ):int {
346
+ return ( x & z ) | ( y & (~z) );
347
+ }
348
+
349
+ /**
350
+ * Auxiliary function h as defined in RFC
351
+ */
352
+ private static function h( x:int, y:int, z:int ):int {
353
+ return x ^ y ^ z;
354
+ }
355
+
356
+ /**
357
+ * Auxiliary function i as defined in RFC
358
+ */
359
+ private static function i( x:int, y:int, z:int ):int {
360
+ return y ^ ( x | (~z) );
361
+ }
362
+
363
+ /**
364
+ * A generic transformation function. The logic of ff, gg, hh, and
365
+ * ii are all the same, minus the function used, so pull that logic
366
+ * out and simplify the method bodies for the transoformation functions.
367
+ */
368
+ private static function transform( func:Function, a:int, b:int, c:int, d:int, x:int, s:int, t:int):int {
369
+ var tmp:int = a + int( func( b, c, d ) ) + x + t;
370
+ return IntUtil.rol( tmp, s ) + b;
371
+ }
372
+
373
+ /**
374
+ * ff transformation function
375
+ */
376
+ private static function ff ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
377
+ return transform( f, a, b, c, d, x, s, t );
378
+ }
379
+
380
+ /**
381
+ * gg transformation function
382
+ */
383
+ private static function gg ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
384
+ return transform( g, a, b, c, d, x, s, t );
385
+ }
386
+
387
+ /**
388
+ * hh transformation function
389
+ */
390
+ private static function hh ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
391
+ return transform( h, a, b, c, d, x, s, t );
392
+ }
393
+
394
+ /**
395
+ * ii transformation function
396
+ */
397
+ private static function ii ( a:int, b:int, c:int, d:int, x:int, s:int, t:int ):int {
398
+ return transform( i, a, b, c, d, x, s, t );
399
+ }
400
+
401
+ }
402
+ }
skin/frontend/base/default/uploadfile/com/adobe/crypto/SHA1.as ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.crypto
34
+ {
35
+ import com.adobe.utils.IntUtil;
36
+ import flash.utils.ByteArray;
37
+ import mx.utils.Base64Encoder;
38
+
39
+ /**
40
+ * US Secure Hash Algorithm 1 (SHA1)
41
+ *
42
+ * Implementation based on algorithm description at
43
+ * http://www.faqs.org/rfcs/rfc3174.html
44
+ */
45
+ public class SHA1
46
+ {
47
+ public static var digest:ByteArray;
48
+
49
+ /**
50
+ * Performs the SHA1 hash algorithm on a string.
51
+ *
52
+ * @param s The string to hash
53
+ * @return A string containing the hash value of s
54
+ * @langversion ActionScript 3.0
55
+ * @playerversion 9.0
56
+ * @tiptext
57
+ */
58
+ public static function hash( s:String ):String
59
+ {
60
+ var blocks:Array = createBlocksFromString( s );
61
+ var byteArray:ByteArray = hashBlocks( blocks );
62
+
63
+ return IntUtil.toHex( byteArray.readInt(), true )
64
+ + IntUtil.toHex( byteArray.readInt(), true )
65
+ + IntUtil.toHex( byteArray.readInt(), true )
66
+ + IntUtil.toHex( byteArray.readInt(), true )
67
+ + IntUtil.toHex( byteArray.readInt(), true );
68
+ }
69
+
70
+ /**
71
+ * Performs the SHA1 hash algorithm on a ByteArray.
72
+ *
73
+ * @param data The ByteArray data to hash
74
+ * @return A string containing the hash value of data
75
+ * @langversion ActionScript 3.0
76
+ * @playerversion 9.0
77
+ */
78
+ public static function hashBytes( data:ByteArray ):String
79
+ {
80
+ var blocks:Array = SHA1.createBlocksFromByteArray( data );
81
+ var byteArray:ByteArray = hashBlocks(blocks);
82
+
83
+ return IntUtil.toHex( byteArray.readInt(), true )
84
+ + IntUtil.toHex( byteArray.readInt(), true )
85
+ + IntUtil.toHex( byteArray.readInt(), true )
86
+ + IntUtil.toHex( byteArray.readInt(), true )
87
+ + IntUtil.toHex( byteArray.readInt(), true );
88
+ }
89
+
90
+ /**
91
+ * Performs the SHA1 hash algorithm on a string, then does
92
+ * Base64 encoding on the result.
93
+ *
94
+ * @param s The string to hash
95
+ * @return The base64 encoded hash value of s
96
+ * @langversion ActionScript 3.0
97
+ * @playerversion 9.0
98
+ * @tiptext
99
+ */
100
+ public static function hashToBase64( s:String ):String
101
+ {
102
+ var blocks:Array = SHA1.createBlocksFromString( s );
103
+ var byteArray:ByteArray = hashBlocks(blocks);
104
+
105
+ // ByteArray.toString() returns the contents as a UTF-8 string,
106
+ // which we can't use because certain byte sequences might trigger
107
+ // a UTF-8 conversion. Instead, we convert the bytes to characters
108
+ // one by one.
109
+ var charsInByteArray:String = "";
110
+ byteArray.position = 0;
111
+ for (var j:int = 0; j < byteArray.length; j++)
112
+ {
113
+ var byte:uint = byteArray.readUnsignedByte();
114
+ charsInByteArray += String.fromCharCode(byte);
115
+ }
116
+
117
+ var encoder:Base64Encoder = new Base64Encoder();
118
+ encoder.encode(charsInByteArray);
119
+ return encoder.flush();
120
+ }
121
+
122
+ private static function hashBlocks( blocks:Array ):ByteArray
123
+ {
124
+ // initialize the h's
125
+ var h0:int = 0x67452301;
126
+ var h1:int = 0xefcdab89;
127
+ var h2:int = 0x98badcfe;
128
+ var h3:int = 0x10325476;
129
+ var h4:int = 0xc3d2e1f0;
130
+
131
+ var len:int = blocks.length;
132
+ var w:Array = new Array( 80 );
133
+
134
+ // loop over all of the blocks
135
+ for ( var i:int = 0; i < len; i += 16 ) {
136
+
137
+ // 6.1.c
138
+ var a:int = h0;
139
+ var b:int = h1;
140
+ var c:int = h2;
141
+ var d:int = h3;
142
+ var e:int = h4;
143
+
144
+ // 80 steps to process each block
145
+ // TODO: unroll for faster execution, or 4 loops of
146
+ // 20 each to avoid the k and f function calls
147
+ for ( var t:int = 0; t < 80; t++ ) {
148
+
149
+ if ( t < 16 ) {
150
+ // 6.1.a
151
+ w[ t ] = blocks[ i + t ];
152
+ } else {
153
+ // 6.1.b
154
+ w[ t ] = IntUtil.rol( w[ t - 3 ] ^ w[ t - 8 ] ^ w[ t - 14 ] ^ w[ t - 16 ], 1 );
155
+ }
156
+
157
+ // 6.1.d
158
+ var temp:int = IntUtil.rol( a, 5 ) + f( t, b, c, d ) + e + int( w[ t ] ) + k( t );
159
+
160
+ e = d;
161
+ d = c;
162
+ c = IntUtil.rol( b, 30 );
163
+ b = a;
164
+ a = temp;
165
+ }
166
+
167
+ // 6.1.e
168
+ h0 += a;
169
+ h1 += b;
170
+ h2 += c;
171
+ h3 += d;
172
+ h4 += e;
173
+ }
174
+
175
+ var byteArray:ByteArray = new ByteArray();
176
+ byteArray.writeInt(h0);
177
+ byteArray.writeInt(h1);
178
+ byteArray.writeInt(h2);
179
+ byteArray.writeInt(h3);
180
+ byteArray.writeInt(h4);
181
+ byteArray.position = 0;
182
+
183
+ digest = new ByteArray();
184
+ digest.writeBytes(byteArray);
185
+ digest.position = 0;
186
+ return byteArray;
187
+ }
188
+
189
+ /**
190
+ * Performs the logical function based on t
191
+ */
192
+ private static function f( t:int, b:int, c:int, d:int ):int {
193
+ if ( t < 20 ) {
194
+ return ( b & c ) | ( ~b & d );
195
+ } else if ( t < 40 ) {
196
+ return b ^ c ^ d;
197
+ } else if ( t < 60 ) {
198
+ return ( b & c ) | ( b & d ) | ( c & d );
199
+ }
200
+ return b ^ c ^ d;
201
+ }
202
+
203
+ /**
204
+ * Determines the constant value based on t
205
+ */
206
+ private static function k( t:int ):int {
207
+ if ( t < 20 ) {
208
+ return 0x5a827999;
209
+ } else if ( t < 40 ) {
210
+ return 0x6ed9eba1;
211
+ } else if ( t < 60 ) {
212
+ return 0x8f1bbcdc;
213
+ }
214
+ return 0xca62c1d6;
215
+ }
216
+
217
+ /**
218
+ * Converts a ByteArray to a sequence of 16-word blocks
219
+ * that we'll do the processing on. Appends padding
220
+ * and length in the process.
221
+ *
222
+ * @param data The data to split into blocks
223
+ * @return An array containing the blocks into which data was split
224
+ */
225
+ private static function createBlocksFromByteArray( data:ByteArray ):Array
226
+ {
227
+ var oldPosition:int = data.position;
228
+ data.position = 0;
229
+
230
+ var blocks:Array = new Array();
231
+ var len:int = data.length * 8;
232
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
233
+ for( var i:int = 0; i < len; i += 8 )
234
+ {
235
+ blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 );
236
+ }
237
+
238
+ // append padding and length
239
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
240
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
241
+
242
+ data.position = oldPosition;
243
+
244
+ return blocks;
245
+ }
246
+
247
+ /**
248
+ * Converts a string to a sequence of 16-word blocks
249
+ * that we'll do the processing on. Appends padding
250
+ * and length in the process.
251
+ *
252
+ * @param s The string to split into blocks
253
+ * @return An array containing the blocks that s was split into.
254
+ */
255
+ private static function createBlocksFromString( s:String ):Array
256
+ {
257
+ var blocks:Array = new Array();
258
+ var len:int = s.length * 8;
259
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
260
+ for( var i:int = 0; i < len; i += 8 ) {
261
+ blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 );
262
+ }
263
+
264
+ // append padding and length
265
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
266
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
267
+ return blocks;
268
+ }
269
+
270
+ }
271
+ }
skin/frontend/base/default/uploadfile/com/adobe/crypto/SHA224.as ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.crypto
34
+ {
35
+ import com.adobe.utils.IntUtil;
36
+ import flash.utils.ByteArray;
37
+ import mx.utils.Base64Encoder;
38
+
39
+ /**
40
+ * The SHA-224 algorithm
41
+ *
42
+ * @see http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
43
+ */
44
+ public class SHA224
45
+ {
46
+ public static var digest:ByteArray;
47
+
48
+ /**
49
+ * Performs the SHA224 hash algorithm on a string.
50
+ *
51
+ * @param s The string to hash
52
+ * @return A string containing the hash value of s
53
+ * @langversion ActionScript 3.0
54
+ * @playerversion 9.0
55
+ * @tiptext
56
+ */
57
+ public static function hash( s:String ):String {
58
+ var blocks:Array = createBlocksFromString( s );
59
+ var byteArray:ByteArray = hashBlocks( blocks );
60
+ return IntUtil.toHex( byteArray.readInt(), true )
61
+ + IntUtil.toHex( byteArray.readInt(), true )
62
+ + IntUtil.toHex( byteArray.readInt(), true )
63
+ + IntUtil.toHex( byteArray.readInt(), true )
64
+ + IntUtil.toHex( byteArray.readInt(), true )
65
+ + IntUtil.toHex( byteArray.readInt(), true )
66
+ + IntUtil.toHex( byteArray.readInt(), true );
67
+ }
68
+
69
+ /**
70
+ * Performs the SHA224 hash algorithm on a ByteArray.
71
+ *
72
+ * @param data The ByteArray data to hash
73
+ * @return A string containing the hash value of data
74
+ * @langversion ActionScript 3.0
75
+ * @playerversion 9.0
76
+ */
77
+ public static function hashBytes( data:ByteArray ):String
78
+ {
79
+ var blocks:Array = createBlocksFromByteArray( data );
80
+ var byteArray:ByteArray = hashBlocks(blocks);
81
+ return IntUtil.toHex( byteArray.readInt(), true )
82
+ + IntUtil.toHex( byteArray.readInt(), true )
83
+ + IntUtil.toHex( byteArray.readInt(), true )
84
+ + IntUtil.toHex( byteArray.readInt(), true )
85
+ + IntUtil.toHex( byteArray.readInt(), true )
86
+ + IntUtil.toHex( byteArray.readInt(), true )
87
+ + IntUtil.toHex( byteArray.readInt(), true );
88
+ }
89
+
90
+ /**
91
+ * Performs the SHA224 hash algorithm on a string, then does
92
+ * Base64 encoding on the result.
93
+ *
94
+ * @param s The string to hash
95
+ * @return The base64 encoded hash value of s
96
+ * @langversion ActionScript 3.0
97
+ * @playerversion 9.0
98
+ * @tiptext
99
+ */
100
+ public static function hashToBase64( s:String ):String
101
+ {
102
+ var blocks:Array = createBlocksFromString( s );
103
+ var byteArray:ByteArray = hashBlocks(blocks);
104
+
105
+ // ByteArray.toString() returns the contents as a UTF-8 string,
106
+ // which we can't use because certain byte sequences might trigger
107
+ // a UTF-8 conversion. Instead, we convert the bytes to characters
108
+ // one by one.
109
+ var charsInByteArray:String = "";
110
+ byteArray.position = 0;
111
+ for (var j:int = 0; j < byteArray.length; j++)
112
+ {
113
+ var byte:uint = byteArray.readUnsignedByte();
114
+ charsInByteArray += String.fromCharCode(byte);
115
+ }
116
+
117
+ var encoder:Base64Encoder = new Base64Encoder();
118
+ encoder.encode(charsInByteArray);
119
+ return encoder.flush();
120
+ }
121
+
122
+ private static function hashBlocks( blocks:Array ):ByteArray {
123
+ var h0:int = 0xc1059ed8;
124
+ var h1:int = 0x367cd507;
125
+ var h2:int = 0x3070dd17;
126
+ var h3:int = 0xf70e5939;
127
+ var h4:int = 0xffc00b31;
128
+ var h5:int = 0x68581511;
129
+ var h6:int = 0x64f98fa7;
130
+ var h7:int = 0xbefa4fa4;
131
+
132
+ var k:Array = new Array(0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2);
133
+
134
+ var len:int = blocks.length;
135
+ var w:Array = new Array();
136
+
137
+ // loop over all of the blocks
138
+ for ( var i:int = 0; i < len; i += 16 ) {
139
+
140
+ var a:int = h0;
141
+ var b:int = h1;
142
+ var c:int = h2;
143
+ var d:int = h3;
144
+ var e:int = h4;
145
+ var f:int = h5;
146
+ var g:int = h6;
147
+ var h:int = h7;
148
+
149
+ for(var t:int = 0; t < 64; t++) {
150
+
151
+ if ( t < 16 ) {
152
+ w[t] = blocks[ i + t ];
153
+ if(isNaN(w[t])) { w[t] = 0; }
154
+ } else {
155
+ var ws0:int = IntUtil.ror(w[t-15], 7) ^ IntUtil.ror(w[t-15], 18) ^ (w[t-15] >>> 3);
156
+ var ws1:int = IntUtil.ror(w[t-2], 17) ^ IntUtil.ror(w[t-2], 19) ^ (w[t-2] >>> 10);
157
+ w[t] = w[t-16] + ws0 + w[t-7] + ws1;
158
+ }
159
+
160
+ var s0:int = IntUtil.ror(a, 2) ^ IntUtil.ror(a, 13) ^ IntUtil.ror(a, 22);
161
+ var maj:int = (a & b) ^ (a & c) ^ (b & c);
162
+ var t2:int = s0 + maj;
163
+ var s1:int = IntUtil.ror(e, 6) ^ IntUtil.ror(e, 11) ^ IntUtil.ror(e, 25);
164
+ var ch:int = (e & f) ^ ((~e) & g);
165
+ var t1:int = h + s1 + ch + k[t] + w[t];
166
+
167
+ h = g;
168
+ g = f;
169
+ f = e;
170
+ e = d + t1;
171
+ d = c;
172
+ c = b;
173
+ b = a;
174
+ a = t1 + t2;
175
+ }
176
+
177
+ //Add this chunk's hash to result so far:
178
+ h0 += a;
179
+ h1 += b;
180
+ h2 += c;
181
+ h3 += d;
182
+ h4 += e;
183
+ h5 += f;
184
+ h6 += g;
185
+ h7 += h;
186
+ }
187
+
188
+ var byteArray:ByteArray = new ByteArray();
189
+ byteArray.writeInt(h0);
190
+ byteArray.writeInt(h1);
191
+ byteArray.writeInt(h2);
192
+ byteArray.writeInt(h3);
193
+ byteArray.writeInt(h4);
194
+ byteArray.writeInt(h5);
195
+ byteArray.writeInt(h6);
196
+ byteArray.position = 0;
197
+
198
+ digest = new ByteArray();
199
+ digest.writeBytes(byteArray);
200
+ digest.position = 0;
201
+ return byteArray;
202
+ }
203
+
204
+ /**
205
+ * Converts a ByteArray to a sequence of 16-word blocks
206
+ * that we'll do the processing on. Appends padding
207
+ * and length in the process.
208
+ *
209
+ * @param data The data to split into blocks
210
+ * @return An array containing the blocks into which data was split
211
+ */
212
+ private static function createBlocksFromByteArray( data:ByteArray ):Array
213
+ {
214
+ var oldPosition:int = data.position;
215
+ data.position = 0;
216
+
217
+ var blocks:Array = new Array();
218
+ var len:int = data.length * 8;
219
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
220
+ for( var i:int = 0; i < len; i += 8 )
221
+ {
222
+ blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 );
223
+ }
224
+
225
+ // append padding and length
226
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
227
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
228
+
229
+ data.position = oldPosition;
230
+
231
+ return blocks;
232
+ }
233
+
234
+ /**
235
+ * Converts a string to a sequence of 16-word blocks
236
+ * that we'll do the processing on. Appends padding
237
+ * and length in the process.
238
+ *
239
+ * @param s The string to split into blocks
240
+ * @return An array containing the blocks that s was split into.
241
+ */
242
+ private static function createBlocksFromString( s:String ):Array
243
+ {
244
+ var blocks:Array = new Array();
245
+ var len:int = s.length * 8;
246
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
247
+ for( var i:int = 0; i < len; i += 8 ) {
248
+ blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 );
249
+ }
250
+
251
+ // append padding and length
252
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
253
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
254
+ return blocks;
255
+ }
256
+ }
257
+ }
skin/frontend/base/default/uploadfile/com/adobe/crypto/SHA256.as ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.crypto
34
+ {
35
+ import com.adobe.utils.IntUtil;
36
+ import flash.utils.ByteArray;
37
+ import mx.utils.Base64Encoder;
38
+
39
+ /**
40
+ * The SHA-256 algorithm
41
+ *
42
+ * @see http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
43
+ */
44
+ public class SHA256
45
+ {
46
+ public static var digest:ByteArray;
47
+ /**
48
+ * Performs the SHA256 hash algorithm on a string.
49
+ *
50
+ * @param s The string to hash
51
+ * @return A string containing the hash value of s
52
+ * @langversion ActionScript 3.0
53
+ * @playerversion 9.0
54
+ * @tiptext
55
+ */
56
+ public static function hash( s:String ):String {
57
+ var blocks:Array = createBlocksFromString( s );
58
+ var byteArray:ByteArray = hashBlocks( blocks );
59
+
60
+ return IntUtil.toHex( byteArray.readInt(), true )
61
+ + IntUtil.toHex( byteArray.readInt(), true )
62
+ + IntUtil.toHex( byteArray.readInt(), true )
63
+ + IntUtil.toHex( byteArray.readInt(), true )
64
+ + IntUtil.toHex( byteArray.readInt(), true )
65
+ + IntUtil.toHex( byteArray.readInt(), true )
66
+ + IntUtil.toHex( byteArray.readInt(), true )
67
+ + IntUtil.toHex( byteArray.readInt(), true );
68
+ }
69
+
70
+ /**
71
+ * Performs the SHA256 hash algorithm on a ByteArray.
72
+ *
73
+ * @param data The ByteArray data to hash
74
+ * @return A string containing the hash value of data
75
+ * @langversion ActionScript 3.0
76
+ * @playerversion 9.0
77
+ */
78
+ public static function hashBytes( data:ByteArray ):String
79
+ {
80
+ var blocks:Array = createBlocksFromByteArray( data );
81
+ var byteArray:ByteArray = hashBlocks(blocks);
82
+
83
+ return IntUtil.toHex( byteArray.readInt(), true )
84
+ + IntUtil.toHex( byteArray.readInt(), true )
85
+ + IntUtil.toHex( byteArray.readInt(), true )
86
+ + IntUtil.toHex( byteArray.readInt(), true )
87
+ + IntUtil.toHex( byteArray.readInt(), true )
88
+ + IntUtil.toHex( byteArray.readInt(), true )
89
+ + IntUtil.toHex( byteArray.readInt(), true )
90
+ + IntUtil.toHex( byteArray.readInt(), true );
91
+ }
92
+
93
+ /**
94
+ * Performs the SHA256 hash algorithm on a string, then does
95
+ * Base64 encoding on the result.
96
+ *
97
+ * @param s The string to hash
98
+ * @return The base64 encoded hash value of s
99
+ * @langversion ActionScript 3.0
100
+ * @playerversion 9.0
101
+ * @tiptext
102
+ */
103
+ public static function hashToBase64( s:String ):String
104
+ {
105
+ var blocks:Array = createBlocksFromString( s );
106
+ var byteArray:ByteArray = hashBlocks(blocks);
107
+
108
+ // ByteArray.toString() returns the contents as a UTF-8 string,
109
+ // which we can't use because certain byte sequences might trigger
110
+ // a UTF-8 conversion. Instead, we convert the bytes to characters
111
+ // one by one.
112
+ var charsInByteArray:String = "";
113
+ byteArray.position = 0;
114
+ for (var j:int = 0; j < byteArray.length; j++)
115
+ {
116
+ var byte:uint = byteArray.readUnsignedByte();
117
+ charsInByteArray += String.fromCharCode(byte);
118
+ }
119
+
120
+ var encoder:Base64Encoder = new Base64Encoder();
121
+ encoder.encode(charsInByteArray);
122
+ return encoder.flush();
123
+ }
124
+
125
+ private static function hashBlocks( blocks:Array ):ByteArray {
126
+ var h0:int = 0x6a09e667;
127
+ var h1:int = 0xbb67ae85;
128
+ var h2:int = 0x3c6ef372;
129
+ var h3:int = 0xa54ff53a;
130
+ var h4:int = 0x510e527f;
131
+ var h5:int = 0x9b05688c;
132
+ var h6:int = 0x1f83d9ab;
133
+ var h7:int = 0x5be0cd19;
134
+
135
+ var k:Array = new Array(0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2);
136
+
137
+ var len:int = blocks.length;
138
+ var w:Array = new Array( 64 );
139
+
140
+ // loop over all of the blocks
141
+ for ( var i:int = 0; i < len; i += 16 ) {
142
+
143
+ var a:int = h0;
144
+ var b:int = h1;
145
+ var c:int = h2;
146
+ var d:int = h3;
147
+ var e:int = h4;
148
+ var f:int = h5;
149
+ var g:int = h6;
150
+ var h:int = h7;
151
+
152
+ for(var t:int = 0; t < 64; t++) {
153
+
154
+ if ( t < 16 ) {
155
+ w[t] = blocks[ i + t ];
156
+ if(isNaN(w[t])) { w[t] = 0; }
157
+ } else {
158
+ var ws0:int = IntUtil.ror(w[t-15], 7) ^ IntUtil.ror(w[t-15], 18) ^ (w[t-15] >>> 3);
159
+ var ws1:int = IntUtil.ror(w[t-2], 17) ^ IntUtil.ror(w[t-2], 19) ^ (w[t-2] >>> 10);
160
+ w[t] = w[t-16] + ws0 + w[t-7] + ws1;
161
+ }
162
+
163
+ var s0:int = IntUtil.ror(a, 2) ^ IntUtil.ror(a, 13) ^ IntUtil.ror(a, 22);
164
+ var maj:int = (a & b) ^ (a & c) ^ (b & c);
165
+ var t2:int = s0 + maj;
166
+ var s1:int = IntUtil.ror(e, 6) ^ IntUtil.ror(e, 11) ^ IntUtil.ror(e, 25);
167
+ var ch:int = (e & f) ^ ((~e) & g);
168
+ var t1:int = h + s1 + ch + k[t] + w[t];
169
+
170
+ h = g;
171
+ g = f;
172
+ f = e;
173
+ e = d + t1;
174
+ d = c;
175
+ c = b;
176
+ b = a;
177
+ a = t1 + t2;
178
+ }
179
+
180
+ //Add this chunk's hash to result so far:
181
+ h0 += a;
182
+ h1 += b;
183
+ h2 += c;
184
+ h3 += d;
185
+ h4 += e;
186
+ h5 += f;
187
+ h6 += g;
188
+ h7 += h;
189
+ }
190
+
191
+ var byteArray:ByteArray = new ByteArray();
192
+ byteArray.writeInt(h0);
193
+ byteArray.writeInt(h1);
194
+ byteArray.writeInt(h2);
195
+ byteArray.writeInt(h3);
196
+ byteArray.writeInt(h4);
197
+ byteArray.writeInt(h5);
198
+ byteArray.writeInt(h6);
199
+ byteArray.writeInt(h7);
200
+ byteArray.position = 0;
201
+
202
+ digest = new ByteArray();
203
+ digest.writeBytes(byteArray);
204
+ digest.position = 0;
205
+ return byteArray;
206
+ }
207
+
208
+ /**
209
+ * Converts a ByteArray to a sequence of 16-word blocks
210
+ * that we'll do the processing on. Appends padding
211
+ * and length in the process.
212
+ *
213
+ * @param data The data to split into blocks
214
+ * @return An array containing the blocks into which data was split
215
+ */
216
+ private static function createBlocksFromByteArray( data:ByteArray ):Array
217
+ {
218
+ var oldPosition:int = data.position;
219
+ data.position = 0;
220
+
221
+ var blocks:Array = new Array();
222
+ var len:int = data.length * 8;
223
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
224
+ for( var i:int = 0; i < len; i += 8 )
225
+ {
226
+ blocks[ i >> 5 ] |= ( data.readByte() & mask ) << ( 24 - i % 32 );
227
+ }
228
+
229
+ // append padding and length
230
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
231
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
232
+
233
+ data.position = oldPosition;
234
+
235
+ return blocks;
236
+ }
237
+
238
+ /**
239
+ * Converts a string to a sequence of 16-word blocks
240
+ * that we'll do the processing on. Appends padding
241
+ * and length in the process.
242
+ *
243
+ * @param s The string to split into blocks
244
+ * @return An array containing the blocks that s was split into.
245
+ */
246
+ private static function createBlocksFromString( s:String ):Array
247
+ {
248
+ var blocks:Array = new Array();
249
+ var len:int = s.length * 8;
250
+ var mask:int = 0xFF; // ignore hi byte of characters > 0xFF
251
+ for( var i:int = 0; i < len; i += 8 ) {
252
+ blocks[ i >> 5 ] |= ( s.charCodeAt( i / 8 ) & mask ) << ( 24 - i % 32 );
253
+ }
254
+
255
+ // append padding and length
256
+ blocks[ len >> 5 ] |= 0x80 << ( 24 - len % 32 );
257
+ blocks[ ( ( ( len + 64 ) >> 9 ) << 4 ) + 15 ] = len;
258
+ return blocks;
259
+ }
260
+ }
261
+ }
skin/frontend/base/default/uploadfile/com/adobe/crypto/WSSEUsernameToken.as ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.crypto
34
+ {
35
+ import mx.formatters.DateFormatter;
36
+ import mx.utils.Base64Encoder;
37
+
38
+ /**
39
+ * Web Services Security Username Token
40
+ *
41
+ * Implementation based on algorithm description at
42
+ * http://www.oasis-open.org/committees/wss/documents/WSS-Username-02-0223-merged.pdf
43
+ */
44
+ public class WSSEUsernameToken
45
+ {
46
+ /**
47
+ * Generates a WSSE Username Token.
48
+ *
49
+ * @param username The username
50
+ * @param password The password
51
+ * @param nonce A cryptographically random nonce (if null, the nonce
52
+ * will be generated)
53
+ * @param timestamp The time at which the token is generated (if null,
54
+ * the time will be set to the moment of execution)
55
+ * @return The generated token
56
+ * @langversion ActionScript 3.0
57
+ * @playerversion Flash 9.0
58
+ * @tiptext
59
+ */
60
+ public static function getUsernameToken(username:String, password:String, nonce:String=null, timestamp:Date=null):String
61
+ {
62
+ if (nonce == null)
63
+ {
64
+ nonce = generateNonce();
65
+ }
66
+ nonce = base64Encode(nonce);
67
+
68
+ var created:String = generateTimestamp(timestamp);
69
+
70
+ var password64:String = getBase64Digest(nonce,
71
+ created,
72
+ password);
73
+
74
+ var token:String = new String("UsernameToken Username=\"");
75
+ token += username + "\", " +
76
+ "PasswordDigest=\"" + password64 + "\", " +
77
+ "Nonce=\"" + nonce + "\", " +
78
+ "Created=\"" + created + "\"";
79
+ return token;
80
+ }
81
+
82
+ private static function generateNonce():String
83
+ {
84
+ // Math.random returns a Number between 0 and 1. We don't want our
85
+ // nonce to contain invalid characters (e.g. the period) so we
86
+ // strip them out before returning the result.
87
+ var s:String = Math.random().toString();
88
+ return s.replace(".", "");
89
+ }
90
+
91
+ internal static function base64Encode(s:String):String
92
+ {
93
+ var encoder:Base64Encoder = new Base64Encoder();
94
+ encoder.encode(s);
95
+ return encoder.flush();
96
+ }
97
+
98
+ internal static function generateTimestamp(timestamp:Date):String
99
+ {
100
+ if (timestamp == null)
101
+ {
102
+ timestamp = new Date();
103
+ }
104
+ var dateFormatter:DateFormatter = new DateFormatter();
105
+ dateFormatter.formatString = "YYYY-MM-DDTJJ:NN:SS"
106
+ return dateFormatter.format(timestamp) + "Z";
107
+ }
108
+
109
+ internal static function getBase64Digest(nonce:String, created:String, password:String):String
110
+ {
111
+ return SHA1.hashToBase64(nonce + created + password);
112
+ }
113
+ }
114
+ }
skin/frontend/base/default/uploadfile/com/adobe/errors/IllegalStateError.as ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.errors
34
+ {
35
+ /**
36
+ * This class represents an Error that is thrown when a method is called when
37
+ * the receiving instance is in an invalid state.
38
+ *
39
+ * For example, this may occur if a method has been called, and other properties
40
+ * in the instance have not been initialized properly.
41
+ *
42
+ * @langversion ActionScript 3.0
43
+ * @playerversion Flash 9.0
44
+ * @tiptext
45
+ *
46
+ */
47
+ public class IllegalStateError extends Error
48
+ {
49
+ /**
50
+ * Constructor
51
+ *
52
+ * @param message A message describing the error in detail.
53
+ *
54
+ * @langversion ActionScript 3.0
55
+ * @playerversion Flash 9.0
56
+ * @tiptext
57
+ */
58
+ public function IllegalStateError(message:String)
59
+ {
60
+ super(message);
61
+ }
62
+ }
63
+ }
skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/Address.as ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.fileformats.vcard
33
+ {
34
+ public class Address
35
+ {
36
+ public var type:String;
37
+ public var street:String;
38
+ public var city:String;
39
+ public var state:String;
40
+ public var postalCode:String;
41
+
42
+ public function toString():String
43
+ {
44
+ return (street + " " + city + ", " + state + " " + postalCode);
45
+ }
46
+ }
47
+ }
skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/Email.as ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.fileformats.vcard
33
+ {
34
+ public class Email
35
+ {
36
+ public var type:String;
37
+ public var address:String;
38
+ }
39
+ }
skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/Phone.as ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.fileformats.vcard
33
+ {
34
+ public class Phone
35
+ {
36
+ public var type:String;
37
+ public var number:String;
38
+ }
39
+ }
skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/VCard.as ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.fileformats.vcard
33
+ {
34
+ import flash.utils.ByteArray;
35
+
36
+ public class VCard
37
+ {
38
+ public var fullName:String;
39
+ public var orgs:Array;
40
+ public var title:String;
41
+ public var image:ByteArray;
42
+ public var phones:Array;
43
+ public var emails:Array;
44
+ public var addresses:Array;
45
+
46
+ public function VCard()
47
+ {
48
+ orgs = new Array();
49
+ phones = new Array();
50
+ emails = new Array();
51
+ addresses = new Array();
52
+ }
53
+ }
54
+ }
skin/frontend/base/default/uploadfile/com/adobe/fileformats/vcard/VCardParser.as ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.fileformats.vcard
33
+ {
34
+ import mx.utils.Base64Decoder;
35
+ import mx.utils.StringUtil;
36
+
37
+ public class VCardParser
38
+ {
39
+ public static function parse(vcardStr:String):Array
40
+ {
41
+ var vcards:Array = new Array();
42
+ var lines:Array = vcardStr.split(/\r\n/);
43
+ var vcard:VCard;
44
+ var type:String;
45
+ var typeTmp:String;
46
+ var line:String;
47
+
48
+ for (var i:uint = 0; i < lines.length; ++i)
49
+ {
50
+ line = lines[i];
51
+ if (line == "BEGIN:VCARD")
52
+ {
53
+ vcard = new VCard();
54
+ }
55
+ else if (line == "END:VCARD")
56
+ {
57
+ if (vcard != null)
58
+ {
59
+ vcards.push(vcard);
60
+ }
61
+ }
62
+ else if(line.search(/^ORG/i) != -1)
63
+ {
64
+ var org:String = line.substring(4, line.length);
65
+ var orgArray:Array = org.split(";");
66
+ for each (var orgToken:String in orgArray)
67
+ {
68
+ if (StringUtil.trim(orgToken).length > 0)
69
+ {
70
+ vcard.orgs.push(orgToken);
71
+ }
72
+ }
73
+ }
74
+ else if(line.search(/^TITLE/i) != -1)
75
+ {
76
+ var title:String = line.substring(6, line.length);
77
+ vcard.title = title;
78
+ }
79
+ else if (line.search(/^FN:/i) != -1)
80
+ {
81
+ var fullName:String = line.substring(3, line.length);
82
+ vcard.fullName = fullName;
83
+ }
84
+ else if (line.search(/^TEL/i) != -1)
85
+ {
86
+ type = new String();
87
+ typeTmp = new String();
88
+ var phone:Phone = new Phone();
89
+ var number:String;
90
+ var phoneTokens:Array = line.split(";");
91
+ for each (var phoneToken:String in phoneTokens)
92
+ {
93
+ if (phoneToken.search(/^TYPE=/i) != -1)
94
+ {
95
+ if (phoneToken.indexOf(":") != -1)
96
+ {
97
+ typeTmp = phoneToken.substring(5, phoneToken.indexOf(":"));
98
+ number = phoneToken.substring(phoneToken.indexOf(":")+1, phoneToken.length);
99
+ }
100
+ else
101
+ {
102
+ typeTmp = phoneToken.substring(5, phoneToken.length);
103
+ }
104
+
105
+ typeTmp = typeTmp.toLocaleLowerCase();
106
+
107
+ if (typeTmp == "pref")
108
+ {
109
+ continue;
110
+ }
111
+ if (type.length != 0)
112
+ {
113
+ type += (" ");
114
+ }
115
+ type += typeTmp;
116
+ }
117
+ }
118
+ if (type.length > 0 && number != null)
119
+ {
120
+ phone.type = type;
121
+ phone.number = number;
122
+ }
123
+ vcard.phones.push(phone);
124
+ }
125
+ else if (line.search(/^EMAIL/i) != -1)
126
+ {
127
+ type = new String();
128
+ typeTmp = new String();
129
+ var email:Email = new Email();
130
+ var emailAddress:String;
131
+ var emailTokens:Array = line.split(";");
132
+ for each (var emailToken:String in emailTokens)
133
+ {
134
+ if (emailToken.search(/^TYPE=/i) != -1)
135
+ {
136
+ if (emailToken.indexOf(":") != -1)
137
+ {
138
+ typeTmp = emailToken.substring(5, emailToken.indexOf(":"));
139
+ emailAddress = emailToken.substring(emailToken.indexOf(":")+1, emailToken.length);
140
+ }
141
+ else
142
+ {
143
+ typeTmp = emailToken.substring(5, emailToken.length);
144
+ }
145
+
146
+ typeTmp = typeTmp.toLocaleLowerCase();
147
+
148
+ if (typeTmp == "pref" || typeTmp == "internet")
149
+ {
150
+ continue;
151
+ }
152
+ if (type.length != 0)
153
+ {
154
+ type += (" ");
155
+ }
156
+ type += typeTmp;
157
+ }
158
+ }
159
+ if (type.length > 0 && emailAddress != null)
160
+ {
161
+ email.type = type;
162
+ email.address = emailAddress;
163
+ }
164
+ vcard.emails.push(email);
165
+ }
166
+ else if (line.indexOf("ADR;") != -1)
167
+ {
168
+ var addressTokens:Array = line.split(";");
169
+ var address:Address = new Address();
170
+ for (var j:uint = 0; j < addressTokens.length; ++j)
171
+ {
172
+ var addressToken:String = addressTokens[j];
173
+ if (addressToken.search(/^home:+$/i) != -1) // For Outlook, which uses non-standard vCards.
174
+ {
175
+ address.type = "home";
176
+ }
177
+ else if (addressToken.search(/^work:+$/i) != -1) // For Outlook, which uses non-standard vCards.
178
+ {
179
+ address.type = "work";
180
+ }
181
+ if (addressToken.search(/^type=/i) != -1) // The "type" parameter is the standard way (which Address Book uses)
182
+ {
183
+ // First, remove the optional ":" character.
184
+ addressToken = addressToken.replace(/:/,"");
185
+ var addressType:String = addressToken.substring(5, addressToken.length).toLowerCase();
186
+ if (addressType == "pref") // Not interested in which one is preferred.
187
+ {
188
+ continue;
189
+ }
190
+ else if (addressType.indexOf("home") != -1) // home
191
+ {
192
+ addressType = "home";
193
+ }
194
+ else if (addressType.indexOf("work") != -1) // work
195
+ {
196
+ addressType = "work";
197
+ }
198
+ else if (addressType.indexOf(",") != -1) // if the comma technique is used, just use the first one
199
+ {
200
+ var typeTokens:Array = addressType.split(",");
201
+ for each (var typeToken:String in typeTokens)
202
+ {
203
+ if (typeToken != "pref")
204
+ {
205
+ addressType = typeToken;
206
+ break;
207
+ }
208
+ }
209
+ }
210
+ address.type = addressType;
211
+ }
212
+ else if (addressToken.search(/^\d/) != -1 && address.street == null)
213
+ {
214
+ address.street = addressToken.replace(/\\n/, "");
215
+ address.city = addressTokens[j+1];
216
+ address.state = addressTokens[j+2];
217
+ address.postalCode = addressTokens[j+3];
218
+ }
219
+ }
220
+ if (address.type != null && address.street != null)
221
+ {
222
+ vcard.addresses.push(address);
223
+ }
224
+
225
+ }
226
+ else if (line.search(/^PHOTO;BASE64/i) != -1)
227
+ {
228
+ var imageStr:String = new String();
229
+ for (var k:uint = i+1; k < lines.length; ++k)
230
+ {
231
+ imageStr += lines[k];
232
+ //if (lines[k].search(/.+\=$/) != -1) // Very slow in Mac due to RegEx bug
233
+ if (lines[k].indexOf('=') != -1)
234
+ {
235
+ var decoder:Base64Decoder = new Base64Decoder();
236
+ decoder.decode(imageStr);
237
+ vcard.image = decoder.flush();
238
+ break;
239
+ }
240
+ }
241
+ }
242
+ }
243
+ return vcards;
244
+ }
245
+ }
246
+ }
skin/frontend/base/default/uploadfile/com/adobe/images/BitString.as ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.images
33
+ {
34
+ public class BitString
35
+ {
36
+ public var len:int = 0;
37
+ public var val:int = 0;
38
+ }
39
+ }
skin/frontend/base/default/uploadfile/com/adobe/images/JPGEncoder.as ADDED
@@ -0,0 +1,648 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.images
33
+ {
34
+ import flash.geom.*;
35
+ import flash.display.*;
36
+ import flash.utils.*;
37
+
38
+ /**
39
+ * Class that converts BitmapData into a valid JPEG
40
+ */
41
+ public class JPGEncoder
42
+ {
43
+
44
+ // Static table initialization
45
+
46
+ private var ZigZag:Array = [
47
+ 0, 1, 5, 6,14,15,27,28,
48
+ 2, 4, 7,13,16,26,29,42,
49
+ 3, 8,12,17,25,30,41,43,
50
+ 9,11,18,24,31,40,44,53,
51
+ 10,19,23,32,39,45,52,54,
52
+ 20,22,33,38,46,51,55,60,
53
+ 21,34,37,47,50,56,59,61,
54
+ 35,36,48,49,57,58,62,63
55
+ ];
56
+
57
+ private var YTable:Array = new Array(64);
58
+ private var UVTable:Array = new Array(64);
59
+ private var fdtbl_Y:Array = new Array(64);
60
+ private var fdtbl_UV:Array = new Array(64);
61
+
62
+ private function initQuantTables(sf:int):void
63
+ {
64
+ var i:int;
65
+ var t:Number;
66
+ var YQT:Array = [
67
+ 16, 11, 10, 16, 24, 40, 51, 61,
68
+ 12, 12, 14, 19, 26, 58, 60, 55,
69
+ 14, 13, 16, 24, 40, 57, 69, 56,
70
+ 14, 17, 22, 29, 51, 87, 80, 62,
71
+ 18, 22, 37, 56, 68,109,103, 77,
72
+ 24, 35, 55, 64, 81,104,113, 92,
73
+ 49, 64, 78, 87,103,121,120,101,
74
+ 72, 92, 95, 98,112,100,103, 99
75
+ ];
76
+ for (i = 0; i < 64; i++) {
77
+ t = Math.floor((YQT[i]*sf+50)/100);
78
+ if (t < 1) {
79
+ t = 1;
80
+ } else if (t > 255) {
81
+ t = 255;
82
+ }
83
+ YTable[ZigZag[i]] = t;
84
+ }
85
+ var UVQT:Array = [
86
+ 17, 18, 24, 47, 99, 99, 99, 99,
87
+ 18, 21, 26, 66, 99, 99, 99, 99,
88
+ 24, 26, 56, 99, 99, 99, 99, 99,
89
+ 47, 66, 99, 99, 99, 99, 99, 99,
90
+ 99, 99, 99, 99, 99, 99, 99, 99,
91
+ 99, 99, 99, 99, 99, 99, 99, 99,
92
+ 99, 99, 99, 99, 99, 99, 99, 99,
93
+ 99, 99, 99, 99, 99, 99, 99, 99
94
+ ];
95
+ for (i = 0; i < 64; i++) {
96
+ t = Math.floor((UVQT[i]*sf+50)/100);
97
+ if (t < 1) {
98
+ t = 1;
99
+ } else if (t > 255) {
100
+ t = 255;
101
+ }
102
+ UVTable[ZigZag[i]] = t;
103
+ }
104
+ var aasf:Array = [
105
+ 1.0, 1.387039845, 1.306562965, 1.175875602,
106
+ 1.0, 0.785694958, 0.541196100, 0.275899379
107
+ ];
108
+ i = 0;
109
+ for (var row:int = 0; row < 8; row++)
110
+ {
111
+ for (var col:int = 0; col < 8; col++)
112
+ {
113
+ fdtbl_Y[i] = (1.0 / (YTable [ZigZag[i]] * aasf[row] * aasf[col] * 8.0));
114
+ fdtbl_UV[i] = (1.0 / (UVTable[ZigZag[i]] * aasf[row] * aasf[col] * 8.0));
115
+ i++;
116
+ }
117
+ }
118
+ }
119
+
120
+ private var YDC_HT:Array;
121
+ private var UVDC_HT:Array;
122
+ private var YAC_HT:Array;
123
+ private var UVAC_HT:Array;
124
+
125
+ private function computeHuffmanTbl(nrcodes:Array, std_table:Array):Array
126
+ {
127
+ var codevalue:int = 0;
128
+ var pos_in_table:int = 0;
129
+ var HT:Array = new Array();
130
+ for (var k:int=1; k<=16; k++) {
131
+ for (var j:int=1; j<=nrcodes[k]; j++) {
132
+ HT[std_table[pos_in_table]] = new BitString();
133
+ HT[std_table[pos_in_table]].val = codevalue;
134
+ HT[std_table[pos_in_table]].len = k;
135
+ pos_in_table++;
136
+ codevalue++;
137
+ }
138
+ codevalue*=2;
139
+ }
140
+ return HT;
141
+ }
142
+
143
+ private var std_dc_luminance_nrcodes:Array = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0];
144
+ private var std_dc_luminance_values:Array = [0,1,2,3,4,5,6,7,8,9,10,11];
145
+ private var std_ac_luminance_nrcodes:Array = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d];
146
+ private var std_ac_luminance_values:Array = [
147
+ 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,
148
+ 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,
149
+ 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08,
150
+ 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,
151
+ 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,
152
+ 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28,
153
+ 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,
154
+ 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,
155
+ 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,
156
+ 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,
157
+ 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,
158
+ 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
159
+ 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,
160
+ 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,
161
+ 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,
162
+ 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,
163
+ 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,
164
+ 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2,
165
+ 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,
166
+ 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
167
+ 0xf9,0xfa
168
+ ];
169
+
170
+ private var std_dc_chrominance_nrcodes:Array = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0];
171
+ private var std_dc_chrominance_values:Array = [0,1,2,3,4,5,6,7,8,9,10,11];
172
+ private var std_ac_chrominance_nrcodes:Array = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77];
173
+ private var std_ac_chrominance_values:Array = [
174
+ 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,
175
+ 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,
176
+ 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,
177
+ 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,
178
+ 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,
179
+ 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26,
180
+ 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,
181
+ 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,
182
+ 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,
183
+ 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,
184
+ 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,
185
+ 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87,
186
+ 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,
187
+ 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,
188
+ 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,
189
+ 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,
190
+ 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,
191
+ 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,
192
+ 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,
193
+ 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,
194
+ 0xf9,0xfa
195
+ ];
196
+
197
+ private function initHuffmanTbl():void
198
+ {
199
+ YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values);
200
+ UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values);
201
+ YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values);
202
+ UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values);
203
+ }
204
+
205
+ private var bitcode:Array = new Array(65535);
206
+ private var category:Array = new Array(65535);
207
+
208
+ private function initCategoryNumber():void
209
+ {
210
+ var nrlower:int = 1;
211
+ var nrupper:int = 2;
212
+ var nr:int;
213
+ for (var cat:int=1; cat<=15; cat++) {
214
+ //Positive numbers
215
+ for (nr=nrlower; nr<nrupper; nr++) {
216
+ category[32767+nr] = cat;
217
+ bitcode[32767+nr] = new BitString();
218
+ bitcode[32767+nr].len = cat;
219
+ bitcode[32767+nr].val = nr;
220
+ }
221
+ //Negative numbers
222
+ for (nr=-(nrupper-1); nr<=-nrlower; nr++) {
223
+ category[32767+nr] = cat;
224
+ bitcode[32767+nr] = new BitString();
225
+ bitcode[32767+nr].len = cat;
226
+ bitcode[32767+nr].val = nrupper-1+nr;
227
+ }
228
+ nrlower <<= 1;
229
+ nrupper <<= 1;
230
+ }
231
+ }
232
+
233
+ // IO functions
234
+
235
+ private var byteout:ByteArray;
236
+ private var bytenew:int = 0;
237
+ private var bytepos:int = 7;
238
+
239
+ private function writeBits(bs:BitString):void
240
+ {
241
+ var value:int = bs.val;
242
+ var posval:int = bs.len-1;
243
+ while ( posval >= 0 ) {
244
+ if (value & uint(1 << posval) ) {
245
+ bytenew |= uint(1 << bytepos);
246
+ }
247
+ posval--;
248
+ bytepos--;
249
+ if (bytepos < 0) {
250
+ if (bytenew == 0xFF) {
251
+ writeByte(0xFF);
252
+ writeByte(0);
253
+ }
254
+ else {
255
+ writeByte(bytenew);
256
+ }
257
+ bytepos=7;
258
+ bytenew=0;
259
+ }
260
+ }
261
+ }
262
+
263
+ private function writeByte(value:int):void
264
+ {
265
+ byteout.writeByte(value);
266
+ }
267
+
268
+ private function writeWord(value:int):void
269
+ {
270
+ writeByte((value>>8)&0xFF);
271
+ writeByte((value )&0xFF);
272
+ }
273
+
274
+ // DCT & quantization core
275
+
276
+ private function fDCTQuant(data:Array, fdtbl:Array):Array
277
+ {
278
+ var tmp0:Number, tmp1:Number, tmp2:Number, tmp3:Number, tmp4:Number, tmp5:Number, tmp6:Number, tmp7:Number;
279
+ var tmp10:Number, tmp11:Number, tmp12:Number, tmp13:Number;
280
+ var z1:Number, z2:Number, z3:Number, z4:Number, z5:Number, z11:Number, z13:Number;
281
+ var i:int;
282
+ /* Pass 1: process rows. */
283
+ var dataOff:int=0;
284
+ for (i=0; i<8; i++) {
285
+ tmp0 = data[dataOff+0] + data[dataOff+7];
286
+ tmp7 = data[dataOff+0] - data[dataOff+7];
287
+ tmp1 = data[dataOff+1] + data[dataOff+6];
288
+ tmp6 = data[dataOff+1] - data[dataOff+6];
289
+ tmp2 = data[dataOff+2] + data[dataOff+5];
290
+ tmp5 = data[dataOff+2] - data[dataOff+5];
291
+ tmp3 = data[dataOff+3] + data[dataOff+4];
292
+ tmp4 = data[dataOff+3] - data[dataOff+4];
293
+
294
+ /* Even part */
295
+ tmp10 = tmp0 + tmp3; /* phase 2 */
296
+ tmp13 = tmp0 - tmp3;
297
+ tmp11 = tmp1 + tmp2;
298
+ tmp12 = tmp1 - tmp2;
299
+
300
+ data[dataOff+0] = tmp10 + tmp11; /* phase 3 */
301
+ data[dataOff+4] = tmp10 - tmp11;
302
+
303
+ z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */
304
+ data[dataOff+2] = tmp13 + z1; /* phase 5 */
305
+ data[dataOff+6] = tmp13 - z1;
306
+
307
+ /* Odd part */
308
+ tmp10 = tmp4 + tmp5; /* phase 2 */
309
+ tmp11 = tmp5 + tmp6;
310
+ tmp12 = tmp6 + tmp7;
311
+
312
+ /* The rotator is modified from fig 4-8 to avoid extra negations. */
313
+ z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */
314
+ z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */
315
+ z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */
316
+ z3 = tmp11 * 0.707106781; /* c4 */
317
+
318
+ z11 = tmp7 + z3; /* phase 5 */
319
+ z13 = tmp7 - z3;
320
+
321
+ data[dataOff+5] = z13 + z2; /* phase 6 */
322
+ data[dataOff+3] = z13 - z2;
323
+ data[dataOff+1] = z11 + z4;
324
+ data[dataOff+7] = z11 - z4;
325
+
326
+ dataOff += 8; /* advance pointer to next row */
327
+ }
328
+
329
+ /* Pass 2: process columns. */
330
+ dataOff = 0;
331
+ for (i=0; i<8; i++) {
332
+ tmp0 = data[dataOff+ 0] + data[dataOff+56];
333
+ tmp7 = data[dataOff+ 0] - data[dataOff+56];
334
+ tmp1 = data[dataOff+ 8] + data[dataOff+48];
335
+ tmp6 = data[dataOff+ 8] - data[dataOff+48];
336
+ tmp2 = data[dataOff+16] + data[dataOff+40];
337
+ tmp5 = data[dataOff+16] - data[dataOff+40];
338
+ tmp3 = data[dataOff+24] + data[dataOff+32];
339
+ tmp4 = data[dataOff+24] - data[dataOff+32];
340
+
341
+ /* Even part */
342
+ tmp10 = tmp0 + tmp3; /* phase 2 */
343
+ tmp13 = tmp0 - tmp3;
344
+ tmp11 = tmp1 + tmp2;
345
+ tmp12 = tmp1 - tmp2;
346
+
347
+ data[dataOff+ 0] = tmp10 + tmp11; /* phase 3 */
348
+ data[dataOff+32] = tmp10 - tmp11;
349
+
350
+ z1 = (tmp12 + tmp13) * 0.707106781; /* c4 */
351
+ data[dataOff+16] = tmp13 + z1; /* phase 5 */
352
+ data[dataOff+48] = tmp13 - z1;
353
+
354
+ /* Odd part */
355
+ tmp10 = tmp4 + tmp5; /* phase 2 */
356
+ tmp11 = tmp5 + tmp6;
357
+ tmp12 = tmp6 + tmp7;
358
+
359
+ /* The rotator is modified from fig 4-8 to avoid extra negations. */
360
+ z5 = (tmp10 - tmp12) * 0.382683433; /* c6 */
361
+ z2 = 0.541196100 * tmp10 + z5; /* c2-c6 */
362
+ z4 = 1.306562965 * tmp12 + z5; /* c2+c6 */
363
+ z3 = tmp11 * 0.707106781; /* c4 */
364
+
365
+ z11 = tmp7 + z3; /* phase 5 */
366
+ z13 = tmp7 - z3;
367
+
368
+ data[dataOff+40] = z13 + z2; /* phase 6 */
369
+ data[dataOff+24] = z13 - z2;
370
+ data[dataOff+ 8] = z11 + z4;
371
+ data[dataOff+56] = z11 - z4;
372
+
373
+ dataOff++; /* advance pointer to next column */
374
+ }
375
+
376
+ // Quantize/descale the coefficients
377
+ for (i=0; i<64; i++) {
378
+ // Apply the quantization and scaling factor & Round to nearest integer
379
+ data[i] = Math.round((data[i]*fdtbl[i]));
380
+ }
381
+ return data;
382
+ }
383
+
384
+ // Chunk writing
385
+
386
+ private function writeAPP0():void
387
+ {
388
+ writeWord(0xFFE0); // marker
389
+ writeWord(16); // length
390
+ writeByte(0x4A); // J
391
+ writeByte(0x46); // F
392
+ writeByte(0x49); // I
393
+ writeByte(0x46); // F
394
+ writeByte(0); // = "JFIF",'\0'
395
+ writeByte(1); // versionhi
396
+ writeByte(1); // versionlo
397
+ writeByte(0); // xyunits
398
+ writeWord(1); // xdensity
399
+ writeWord(1); // ydensity
400
+ writeByte(0); // thumbnwidth
401
+ writeByte(0); // thumbnheight
402
+ }
403
+
404
+ private function writeSOF0(width:int, height:int):void
405
+ {
406
+ writeWord(0xFFC0); // marker
407
+ writeWord(17); // length, truecolor YUV JPG
408
+ writeByte(8); // precision
409
+ writeWord(height);
410
+ writeWord(width);
411
+ writeByte(3); // nrofcomponents
412
+ writeByte(1); // IdY
413
+ writeByte(0x11); // HVY
414
+ writeByte(0); // QTY
415
+ writeByte(2); // IdU
416
+ writeByte(0x11); // HVU
417
+ writeByte(1); // QTU
418
+ writeByte(3); // IdV
419
+ writeByte(0x11); // HVV
420
+ writeByte(1); // QTV
421
+ }
422
+
423
+ private function writeDQT():void
424
+ {
425
+ writeWord(0xFFDB); // marker
426
+ writeWord(132); // length
427
+ writeByte(0);
428
+ var i:int;
429
+ for (i=0; i<64; i++) {
430
+ writeByte(YTable[i]);
431
+ }
432
+ writeByte(1);
433
+ for (i=0; i<64; i++) {
434
+ writeByte(UVTable[i]);
435
+ }
436
+ }
437
+
438
+ private function writeDHT():void
439
+ {
440
+ writeWord(0xFFC4); // marker
441
+ writeWord(0x01A2); // length
442
+ var i:int;
443
+
444
+ writeByte(0); // HTYDCinfo
445
+ for (i=0; i<16; i++) {
446
+ writeByte(std_dc_luminance_nrcodes[i+1]);
447
+ }
448
+ for (i=0; i<=11; i++) {
449
+ writeByte(std_dc_luminance_values[i]);
450
+ }
451
+
452
+ writeByte(0x10); // HTYACinfo
453
+ for (i=0; i<16; i++) {
454
+ writeByte(std_ac_luminance_nrcodes[i+1]);
455
+ }
456
+ for (i=0; i<=161; i++) {
457
+ writeByte(std_ac_luminance_values[i]);
458
+ }
459
+
460
+ writeByte(1); // HTUDCinfo
461
+ for (i=0; i<16; i++) {
462
+ writeByte(std_dc_chrominance_nrcodes[i+1]);
463
+ }
464
+ for (i=0; i<=11; i++) {
465
+ writeByte(std_dc_chrominance_values[i]);
466
+ }
467
+
468
+ writeByte(0x11); // HTUACinfo
469
+ for (i=0; i<16; i++) {
470
+ writeByte(std_ac_chrominance_nrcodes[i+1]);
471
+ }
472
+ for (i=0; i<=161; i++) {
473
+ writeByte(std_ac_chrominance_values[i]);
474
+ }
475
+ }
476
+
477
+ private function writeSOS():void
478
+ {
479
+ writeWord(0xFFDA); // marker
480
+ writeWord(12); // length
481
+ writeByte(3); // nrofcomponents
482
+ writeByte(1); // IdY
483
+ writeByte(0); // HTY
484
+ writeByte(2); // IdU
485
+ writeByte(0x11); // HTU
486
+ writeByte(3); // IdV
487
+ writeByte(0x11); // HTV
488
+ writeByte(0); // Ss
489
+ writeByte(0x3f); // Se
490
+ writeByte(0); // Bf
491
+ }
492
+
493
+ // Core processing
494
+ private var DU:Array = new Array(64);
495
+
496
+ private function processDU(CDU:Array, fdtbl:Array, DC:Number, HTDC:Array, HTAC:Array):Number
497
+ {
498
+ var EOB:BitString = HTAC[0x00];
499
+ var M16zeroes:BitString = HTAC[0xF0];
500
+ var i:int;
501
+
502
+ var DU_DCT:Array = fDCTQuant(CDU, fdtbl);
503
+ //ZigZag reorder
504
+ for (i=0;i<64;i++) {
505
+ DU[ZigZag[i]]=DU_DCT[i];
506
+ }
507
+ var Diff:int = DU[0] - DC; DC = DU[0];
508
+ //Encode DC
509
+ if (Diff==0) {
510
+ writeBits(HTDC[0]); // Diff might be 0
511
+ } else {
512
+ writeBits(HTDC[category[32767+Diff]]);
513
+ writeBits(bitcode[32767+Diff]);
514
+ }
515
+ //Encode ACs
516
+ var end0pos:int = 63;
517
+ for (; (end0pos>0)&&(DU[end0pos]==0); end0pos--) {
518
+ };
519
+ //end0pos = first element in reverse order !=0
520
+ if ( end0pos == 0) {
521
+ writeBits(EOB);
522
+ return DC;
523
+ }
524
+ i = 1;
525
+ while ( i <= end0pos ) {
526
+ var startpos:int = i;
527
+ for (; (DU[i]==0) && (i<=end0pos); i++) {
528
+ }
529
+ var nrzeroes:int = i-startpos;
530
+ if ( nrzeroes >= 16 ) {
531
+ for (var nrmarker:int=1; nrmarker <= nrzeroes/16; nrmarker++) {
532
+ writeBits(M16zeroes);
533
+ }
534
+ nrzeroes = int(nrzeroes&0xF);
535
+ }
536
+ writeBits(HTAC[nrzeroes*16+category[32767+DU[i]]]);
537
+ writeBits(bitcode[32767+DU[i]]);
538
+ i++;
539
+ }
540
+ if ( end0pos != 63 ) {
541
+ writeBits(EOB);
542
+ }
543
+ return DC;
544
+ }
545
+
546
+ private var YDU:Array = new Array(64);
547
+ private var UDU:Array = new Array(64);
548
+ private var VDU:Array = new Array(64);
549
+
550
+ private function RGB2YUV(img:BitmapData, xpos:int, ypos:int):void
551
+ {
552
+ var pos:int=0;
553
+ for (var y:int=0; y<8; y++) {
554
+ for (var x:int=0; x<8; x++) {
555
+ var P:uint = img.getPixel32(xpos+x,ypos+y);
556
+ var R:Number = Number((P>>16)&0xFF);
557
+ var G:Number = Number((P>> 8)&0xFF);
558
+ var B:Number = Number((P )&0xFF);
559
+ YDU[pos]=((( 0.29900)*R+( 0.58700)*G+( 0.11400)*B))-128;
560
+ UDU[pos]=(((-0.16874)*R+(-0.33126)*G+( 0.50000)*B));
561
+ VDU[pos]=((( 0.50000)*R+(-0.41869)*G+(-0.08131)*B));
562
+ pos++;
563
+ }
564
+ }
565
+ }
566
+
567
+ /**
568
+ * Constructor for JPEGEncoder class
569
+ *
570
+ * @param quality The quality level between 1 and 100 that detrmines the
571
+ * level of compression used in the generated JPEG
572
+ * @langversion ActionScript 3.0
573
+ * @playerversion Flash 9.0
574
+ * @tiptext
575
+ */
576
+ public function JPGEncoder(quality:Number = 50)
577
+ {
578
+ if (quality <= 0) {
579
+ quality = 1;
580
+ }
581
+ if (quality > 100) {
582
+ quality = 100;
583
+ }
584
+ var sf:int = 0;
585
+ if (quality < 50) {
586
+ sf = int(5000 / quality);
587
+ } else {
588
+ sf = int(200 - quality*2);
589
+ }
590
+ // Create tables
591
+ initHuffmanTbl();
592
+ initCategoryNumber();
593
+ initQuantTables(sf);
594
+ }
595
+
596
+ /**
597
+ * Created a JPEG image from the specified BitmapData
598
+ *
599
+ * @param image The BitmapData that will be converted into the JPEG format.
600
+ * @return a ByteArray representing the JPEG encoded image data.
601
+ * @langversion ActionScript 3.0
602
+ * @playerversion Flash 9.0
603
+ * @tiptext
604
+ */
605
+ public function encode(image:BitmapData):ByteArray
606
+ {
607
+ // Initialize bit writer
608
+ byteout = new ByteArray();
609
+ bytenew=0;
610
+ bytepos=7;
611
+
612
+ // Add JPEG headers
613
+ writeWord(0xFFD8); // SOI
614
+ writeAPP0();
615
+ writeDQT();
616
+ writeSOF0(image.width,image.height);
617
+ writeDHT();
618
+ writeSOS();
619
+
620
+
621
+ // Encode 8x8 macroblocks
622
+ var DCY:Number=0;
623
+ var DCU:Number=0;
624
+ var DCV:Number=0;
625
+ bytenew=0;
626
+ bytepos=7;
627
+ for (var ypos:int=0; ypos<image.height; ypos+=8) {
628
+ for (var xpos:int=0; xpos<image.width; xpos+=8) {
629
+ RGB2YUV(image, xpos, ypos);
630
+ DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
631
+ DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
632
+ DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT);
633
+ }
634
+ }
635
+
636
+ // Do the bit alignment of the EOI marker
637
+ if ( bytepos >= 0 ) {
638
+ var fillbits:BitString = new BitString();
639
+ fillbits.len = bytepos+1;
640
+ fillbits.val = (1<<(bytepos+1))-1;
641
+ writeBits(fillbits);
642
+ }
643
+
644
+ writeWord(0xFFD9); //EOI
645
+ return byteout;
646
+ }
647
+ }
648
+ }
skin/frontend/base/default/uploadfile/com/adobe/images/PNGEncoder.as ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.images
33
+ {
34
+ import flash.geom.*;
35
+ import flash.display.Bitmap;
36
+ import flash.display.BitmapData;
37
+ import flash.utils.ByteArray;
38
+
39
+ /**
40
+ * Class that converts BitmapData into a valid PNG
41
+ */
42
+ public class PNGEncoder
43
+ {
44
+ /**
45
+ * Created a PNG image from the specified BitmapData
46
+ *
47
+ * @param image The BitmapData that will be converted into the PNG format.
48
+ * @return a ByteArray representing the PNG encoded image data.
49
+ * @langversion ActionScript 3.0
50
+ * @playerversion Flash 9.0
51
+ * @tiptext
52
+ */
53
+ public static function encode(img:BitmapData):ByteArray {
54
+ // Create output byte array
55
+ var png:ByteArray = new ByteArray();
56
+ // Write PNG signature
57
+ png.writeUnsignedInt(0x89504e47);
58
+ png.writeUnsignedInt(0x0D0A1A0A);
59
+ // Build IHDR chunk
60
+ var IHDR:ByteArray = new ByteArray();
61
+ IHDR.writeInt(img.width);
62
+ IHDR.writeInt(img.height);
63
+ IHDR.writeUnsignedInt(0x08060000); // 32bit RGBA
64
+ IHDR.writeByte(0);
65
+ writeChunk(png,0x49484452,IHDR);
66
+ // Build IDAT chunk
67
+ var IDAT:ByteArray= new ByteArray();
68
+ for(var i:int=0;i < img.height;i++) {
69
+ // no filter
70
+ IDAT.writeByte(0);
71
+ var p:uint;
72
+ var j:int;
73
+ if ( !img.transparent ) {
74
+ for(j=0;j < img.width;j++) {
75
+ p = img.getPixel(j,i);
76
+ IDAT.writeUnsignedInt(
77
+ uint(((p&0xFFFFFF) << 8)|0xFF));
78
+ }
79
+ } else {
80
+ for(j=0;j < img.width;j++) {
81
+ p = img.getPixel32(j,i);
82
+ IDAT.writeUnsignedInt(
83
+ uint(((p&0xFFFFFF) << 8)|
84
+ (p>>>24)));
85
+ }
86
+ }
87
+ }
88
+ IDAT.compress();
89
+ writeChunk(png,0x49444154,IDAT);
90
+ // Build IEND chunk
91
+ writeChunk(png,0x49454E44,null);
92
+ // return PNG
93
+ return png;
94
+ }
95
+
96
+ private static var crcTable:Array;
97
+ private static var crcTableComputed:Boolean = false;
98
+
99
+ private static function writeChunk(png:ByteArray,
100
+ type:uint, data:ByteArray):void {
101
+ if (!crcTableComputed) {
102
+ crcTableComputed = true;
103
+ crcTable = [];
104
+ var c:uint;
105
+ for (var n:uint = 0; n < 256; n++) {
106
+ c = n;
107
+ for (var k:uint = 0; k < 8; k++) {
108
+ if (c & 1) {
109
+ c = uint(uint(0xedb88320) ^
110
+ uint(c >>> 1));
111
+ } else {
112
+ c = uint(c >>> 1);
113
+ }
114
+ }
115
+ crcTable[n] = c;
116
+ }
117
+ }
118
+ var len:uint = 0;
119
+ if (data != null) {
120
+ len = data.length;
121
+ }
122
+ png.writeUnsignedInt(len);
123
+ var p:uint = png.position;
124
+ png.writeUnsignedInt(type);
125
+ if ( data != null ) {
126
+ png.writeBytes(data);
127
+ }
128
+ var e:uint = png.position;
129
+ png.position = p;
130
+ c = 0xffffffff;
131
+ for (var i:int = 0; i < (e-p); i++) {
132
+ c = uint(crcTable[
133
+ (c ^ png.readUnsignedByte()) &
134
+ uint(0xff)] ^ uint(c >>> 8));
135
+ }
136
+ c = uint(c^uint(0xffffffff));
137
+ png.position = e;
138
+ png.writeUnsignedInt(c);
139
+ }
140
+ }
141
+ }
skin/frontend/base/default/uploadfile/com/adobe/net/DynamicURLLoader.as ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.net
34
+ {
35
+ import flash.net.URLLoader;
36
+
37
+ /**
38
+ * Class that provides a dynamic implimentation of the URLLoader class.
39
+ *
40
+ * This class provides no API implimentations. However, since the class is
41
+ * declared as dynamic, it can be used in place of URLLoader, and allow
42
+ * you to dynamically attach properties to it (which URLLoader does not allow).
43
+ *
44
+ * @langversion ActionScript 3.0
45
+ * @playerversion Flash 9.0
46
+ * @tiptext
47
+ */
48
+ public dynamic class DynamicURLLoader extends URLLoader
49
+ {
50
+ public function DynamicURLLoader()
51
+ {
52
+ super();
53
+ }
54
+ }
55
+ }
skin/frontend/base/default/uploadfile/com/adobe/net/IURIResolver.as ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.net
34
+ {
35
+ /**
36
+ * The URI class cannot know about DNS aliases, virtual hosts, or
37
+ * symbolic links that may be involved. The application can provide
38
+ * an implementation of this interface to resolve the URI before the
39
+ * URI class makes any comparisons. For example, a web host has
40
+ * two aliases:
41
+ *
42
+ * <p><code>
43
+ * http://www.site.com/
44
+ * http://www.site.net/
45
+ * </code></p>
46
+ *
47
+ * <p>The application can provide an implementation that automatically
48
+ * resolves site.net to site.com before URI compares two URI objects.
49
+ * Only the application can know and understand the context in which
50
+ * the URI's are being used.</p>
51
+ *
52
+ * <p>Use the URI.resolver accessor to assign a custom resolver to
53
+ * the URI class. Any resolver specified is global to all instances
54
+ * of URI.</p>
55
+ *
56
+ * <p>URI will call this before performing URI comparisons in the
57
+ * URI.getRelation() and URI.getCommonParent() functions.
58
+ *
59
+ * @see URI.getRelation
60
+ * @see URI.getCommonParent
61
+ *
62
+ * @langversion ActionScript 3.0
63
+ * @playerversion Flash 9.0
64
+ */
65
+ public interface IURIResolver
66
+ {
67
+ /**
68
+ * Implement this method to provide custom URI resolution for
69
+ * your application.
70
+ *
71
+ * @langversion ActionScript 3.0
72
+ * @playerversion Flash 9.0
73
+ */
74
+ function resolve(uri:URI) : URI;
75
+ }
76
+ }
skin/frontend/base/default/uploadfile/com/adobe/net/MimeTypeMap.as ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.net
33
+ {
34
+ public class MimeTypeMap
35
+ {
36
+ private var types:Array =
37
+ [["application/andrew-inset","ez"],
38
+ ["application/atom+xml","atom"],
39
+ ["application/mac-binhex40","hqx"],
40
+ ["application/mac-compactpro","cpt"],
41
+ ["application/mathml+xml","mathml"],
42
+ ["application/msword","doc"],
43
+ ["application/octet-stream","bin","dms","lha","lzh","exe","class","so","dll","dmg"],
44
+ ["application/oda","oda"],
45
+ ["application/ogg","ogg"],
46
+ ["application/pdf","pdf"],
47
+ ["application/postscript","ai","eps","ps"],
48
+ ["application/rdf+xml","rdf"],
49
+ ["application/smil","smi","smil"],
50
+ ["application/srgs","gram"],
51
+ ["application/srgs+xml","grxml"],
52
+ ["application/vnd.adobe.apollo-application-installer-package+zip","air"],
53
+ ["application/vnd.mif","mif"],
54
+ ["application/vnd.mozilla.xul+xml","xul"],
55
+ ["application/vnd.ms-excel","xls"],
56
+ ["application/vnd.ms-powerpoint","ppt"],
57
+ ["application/vnd.rn-realmedia","rm"],
58
+ ["application/vnd.wap.wbxml","wbxml"],
59
+ ["application/vnd.wap.wmlc","wmlc"],
60
+ ["application/vnd.wap.wmlscriptc","wmlsc"],
61
+ ["application/voicexml+xml","vxml"],
62
+ ["application/x-bcpio","bcpio"],
63
+ ["application/x-cdlink","vcd"],
64
+ ["application/x-chess-pgn","pgn"],
65
+ ["application/x-cpio","cpio"],
66
+ ["application/x-csh","csh"],
67
+ ["application/x-director","dcr","dir","dxr"],
68
+ ["application/x-dvi","dvi"],
69
+ ["application/x-futuresplash","spl"],
70
+ ["application/x-gtar","gtar"],
71
+ ["application/x-hdf","hdf"],
72
+ ["application/x-javascript","js"],
73
+ ["application/x-koan","skp","skd","skt","skm"],
74
+ ["application/x-latex","latex"],
75
+ ["application/x-netcdf","nc","cdf"],
76
+ ["application/x-sh","sh"],
77
+ ["application/x-shar","shar"],
78
+ ["application/x-shockwave-flash","swf"],
79
+ ["application/x-stuffit","sit"],
80
+ ["application/x-sv4cpio","sv4cpio"],
81
+ ["application/x-sv4crc","sv4crc"],
82
+ ["application/x-tar","tar"],
83
+ ["application/x-tcl","tcl"],
84
+ ["application/x-tex","tex"],
85
+ ["application/x-texinfo","texinfo","texi"],
86
+ ["application/x-troff","t","tr","roff"],
87
+ ["application/x-troff-man","man"],
88
+ ["application/x-troff-me","me"],
89
+ ["application/x-troff-ms","ms"],
90
+ ["application/x-ustar","ustar"],
91
+ ["application/x-wais-source","src"],
92
+ ["application/xhtml+xml","xhtml","xht"],
93
+ ["application/xml","xml","xsl"],
94
+ ["application/xml-dtd","dtd"],
95
+ ["application/xslt+xml","xslt"],
96
+ ["application/zip","zip"],
97
+ ["audio/basic","au","snd"],
98
+ ["audio/midi","mid","midi","kar"],
99
+ ["audio/mpeg","mp3","mpga","mp2"],
100
+ ["audio/x-aiff","aif","aiff","aifc"],
101
+ ["audio/x-mpegurl","m3u"],
102
+ ["audio/x-pn-realaudio","ram","ra"],
103
+ ["audio/x-wav","wav"],
104
+ ["chemical/x-pdb","pdb"],
105
+ ["chemical/x-xyz","xyz"],
106
+ ["image/bmp","bmp"],
107
+ ["image/cgm","cgm"],
108
+ ["image/gif","gif"],
109
+ ["image/ief","ief"],
110
+ ["image/jpeg","jpg","jpeg","jpe"],
111
+ ["image/png","png"],
112
+ ["image/svg+xml","svg"],
113
+ ["image/tiff","tiff","tif"],
114
+ ["image/vnd.djvu","djvu","djv"],
115
+ ["image/vnd.wap.wbmp","wbmp"],
116
+ ["image/x-cmu-raster","ras"],
117
+ ["image/x-icon","ico"],
118
+ ["image/x-portable-anymap","pnm"],
119
+ ["image/x-portable-bitmap","pbm"],
120
+ ["image/x-portable-graymap","pgm"],
121
+ ["image/x-portable-pixmap","ppm"],
122
+ ["image/x-rgb","rgb"],
123
+ ["image/x-xbitmap","xbm"],
124
+ ["image/x-xpixmap","xpm"],
125
+ ["image/x-xwindowdump","xwd"],
126
+ ["model/iges","igs","iges"],
127
+ ["model/mesh","msh","mesh","silo"],
128
+ ["model/vrml","wrl","vrml"],
129
+ ["text/calendar","ics","ifb"],
130
+ ["text/css","css"],
131
+ ["text/html","html","htm"],
132
+ ["text/plain","txt","asc"],
133
+ ["text/richtext","rtx"],
134
+ ["text/rtf","rtf"],
135
+ ["text/sgml","sgml","sgm"],
136
+ ["text/tab-separated-values","tsv"],
137
+ ["text/vnd.wap.wml","wml"],
138
+ ["text/vnd.wap.wmlscript","wmls"],
139
+ ["text/x-setext","etx"],
140
+ ["video/mpeg","mpg","mpeg","mpe"],
141
+ ["video/quicktime","mov","qt"],
142
+ ["video/vnd.mpegurl","m4u","mxu"],
143
+ ["video/x-flv","flv"],
144
+ ["video/x-msvideo","avi"],
145
+ ["video/x-sgi-movie","movie"],
146
+ ["x-conference/x-cooltalk","ice"]];
147
+
148
+ /**
149
+ * Returns the mimetype for the given extension.
150
+ */
151
+ public function getMimeType(extension:String):String
152
+ {
153
+ extension = extension.toLocaleLowerCase();
154
+ for each (var a:Array in types)
155
+ {
156
+ for each (var b:String in a)
157
+ {
158
+ if (b == extension)
159
+ {
160
+ return a[0];
161
+ }
162
+ }
163
+ }
164
+ return null;
165
+ }
166
+
167
+ /**
168
+ * Returns the prefered extension for the given mimetype.
169
+ */
170
+ public function getExtension(mimetype:String):String
171
+ {
172
+ mimetype = mimetype.toLocaleLowerCase();
173
+ for each (var a:Array in types)
174
+ {
175
+ if (a[0] == mimetype)
176
+ {
177
+ return a[1];
178
+ }
179
+ }
180
+ return null;
181
+ }
182
+
183
+ /**
184
+ * Adds a mimetype to the map. The order of the extensions matters. The most preferred should come first.
185
+ */
186
+ public function addMimeType(mimetype:String, extensions:Array):void
187
+ {
188
+ var newType:Array = [mimetype];
189
+ for each (var a:String in extensions)
190
+ {
191
+ newType.push(a);
192
+ }
193
+ types.push(newType);
194
+ }
195
+ }
196
+ }
skin/frontend/base/default/uploadfile/com/adobe/net/URI.as ADDED
@@ -0,0 +1,2466 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.net
34
+ {
35
+ import flash.utils.ByteArray;
36
+
37
+ /**
38
+ * This class implements functions and utilities for working with URI's
39
+ * (Universal Resource Identifiers). For technical description of the
40
+ * URI syntax, please see RFC 3986 at http://www.ietf.org/rfc/rfc3986.txt
41
+ * or do a web search for "rfc 3986".
42
+ *
43
+ * <p>The most important aspect of URI's to understand is that URI's
44
+ * and URL's are not strings. URI's are complex data structures that
45
+ * encapsulate many pieces of information. The string version of a
46
+ * URI is the serialized representation of that data structure. This
47
+ * string serialization is used to provide a human readable
48
+ * representation and a means to transport the data over the network
49
+ * where it can then be parsed back into its' component parts.</p>
50
+ *
51
+ * <p>URI's fall into one of three categories:
52
+ * <ul>
53
+ * <li>&lt;scheme&gt;:&lt;scheme-specific-part&gt;#&lt;fragment&gt; (non-hierarchical)</li>
54
+ * <li>&lt;scheme&gt;:<authority&gt;&lt;path&gt;?&lt;query&gt;#&lt;fragment&gt; (hierarchical)</li>
55
+ * <li>&lt;path&gt;?&lt;query&gt;#&lt;fragment&gt; (relative hierarchical)</li>
56
+ * </ul></p>
57
+ *
58
+ * <p>The query and fragment parts are optional.</p>
59
+ *
60
+ * <p>This class supports both non-hierarchical and hierarchical URI's</p>
61
+ *
62
+ * <p>This class is intended to be used "as-is" for the vast majority
63
+ * of common URI's. However, if your application requires a custom
64
+ * URI syntax (e.g. custom query syntax or special handling of
65
+ * non-hierarchical URI's), this class can be fully subclassed. If you
66
+ * intended to subclass URI, please see the source code for complete
67
+ * documation on protected members and protected fuctions.</p>
68
+ *
69
+ * @langversion ActionScript 3.0
70
+ * @playerversion Flash 9.0
71
+ */
72
+ public class URI
73
+ {
74
+ // Here we define which characters must be escaped for each
75
+ // URI part. The characters that must be escaped for each
76
+ // part differ depending on what would cause ambiguous parsing.
77
+ // RFC 3986 sec. 2.4 states that characters should only be
78
+ // encoded when they would conflict with subcomponent delimiters.
79
+ // We don't want to over-do the escaping. We only want to escape
80
+ // the minimum needed to prevent parsing problems.
81
+
82
+ // space and % must be escaped in all cases. '%' is the delimiter
83
+ // for escaped characters.
84
+ public static const URImustEscape:String = " %";
85
+
86
+ // Baseline of what characters must be escaped
87
+ public static const URIbaselineEscape:String = URImustEscape + ":?#/@";
88
+
89
+ // Characters that must be escaped in the part part.
90
+ public static const URIpathEscape:String = URImustEscape + "?#";
91
+
92
+ // Characters that must be escaped in the query part, if setting
93
+ // the query as a whole string. If the query is set by
94
+ // name/value, URIqueryPartEscape is used instead.
95
+ public static const URIqueryEscape:String = URImustEscape + "#";
96
+
97
+ // This is what each name/value pair must escape "&=" as well
98
+ // so they don't conflict with the "param=value&param2=value2"
99
+ // syntax.
100
+ public static const URIqueryPartEscape:String = URImustEscape + "#&=";
101
+
102
+ // Non-hierarchical URI's can have query and fragment parts, but
103
+ // we also want to prevent '/' otherwise it might end up looking
104
+ // like a hierarchical URI to the parser.
105
+ public static const URInonHierEscape:String = URImustEscape + "?#/";
106
+
107
+ // Baseline uninitialized setting for the URI scheme.
108
+ public static const UNKNOWN_SCHEME:String = "unknown";
109
+
110
+ // The following bitmaps are used for performance enhanced
111
+ // character escaping.
112
+
113
+ // Baseline characters that need to be escaped. Many parts use
114
+ // this.
115
+ protected static const URIbaselineExcludedBitmap:URIEncodingBitmap =
116
+ new URIEncodingBitmap(URIbaselineEscape);
117
+
118
+ // Scheme escaping bitmap
119
+ protected static const URIschemeExcludedBitmap:URIEncodingBitmap =
120
+ URIbaselineExcludedBitmap;
121
+
122
+ // User/pass escaping bitmap
123
+ protected static const URIuserpassExcludedBitmap:URIEncodingBitmap =
124
+ URIbaselineExcludedBitmap;
125
+
126
+ // Authority escaping bitmap
127
+ protected static const URIauthorityExcludedBitmap:URIEncodingBitmap =
128
+ URIbaselineExcludedBitmap;
129
+
130
+ // Port escaping bitmap
131
+ protected static const URIportExludedBitmap:URIEncodingBitmap =
132
+ URIbaselineExcludedBitmap;
133
+
134
+ // Path escaping bitmap
135
+ protected static const URIpathExcludedBitmap:URIEncodingBitmap =
136
+ new URIEncodingBitmap(URIpathEscape);
137
+
138
+ // Query (whole) escaping bitmap
139
+ protected static const URIqueryExcludedBitmap:URIEncodingBitmap =
140
+ new URIEncodingBitmap(URIqueryEscape);
141
+
142
+ // Query (individual parts) escaping bitmap
143
+ protected static const URIqueryPartExcludedBitmap:URIEncodingBitmap =
144
+ new URIEncodingBitmap(URIqueryPartEscape);
145
+
146
+ // Fragments are the last part in the URI. They only need to
147
+ // escape space, '#', and '%'. Turns out that is what query
148
+ // uses too.
149
+ protected static const URIfragmentExcludedBitmap:URIEncodingBitmap =
150
+ URIqueryExcludedBitmap;
151
+
152
+ // Characters that need to be escaped in the non-hierarchical part
153
+ protected static const URInonHierexcludedBitmap:URIEncodingBitmap =
154
+ new URIEncodingBitmap(URInonHierEscape);
155
+
156
+ // Values used by getRelation()
157
+ public static const NOT_RELATED:int = 0;
158
+ public static const CHILD:int = 1;
159
+ public static const EQUAL:int = 2;
160
+ public static const PARENT:int = 3;
161
+
162
+ //-------------------------------------------------------------------
163
+ // protected class members
164
+ //-------------------------------------------------------------------
165
+ protected var _valid:Boolean = false;
166
+ protected var _relative:Boolean = false;
167
+ protected var _scheme:String = "";
168
+ protected var _authority:String = "";
169
+ protected var _username:String = "";
170
+ protected var _password:String = "";
171
+ protected var _port:String = "";
172
+ protected var _path:String = "";
173
+ protected var _query:String = "";
174
+ protected var _fragment:String = "";
175
+ protected var _nonHierarchical:String = "";
176
+ protected static var _resolver:IURIResolver = null;
177
+
178
+
179
+ /**
180
+ * URI Constructor. If no string is given, this will initialize
181
+ * this URI object to a blank URI.
182
+ */
183
+ public function URI(uri:String = null) : void
184
+ {
185
+ if (uri == null)
186
+ initialize();
187
+ else
188
+ constructURI(uri);
189
+ }
190
+
191
+
192
+ /**
193
+ * @private
194
+ * Method that loads the URI from the given string.
195
+ */
196
+ protected function constructURI(uri:String) : Boolean
197
+ {
198
+ if (!parseURI(uri))
199
+ _valid = false;
200
+
201
+ return isValid();
202
+ }
203
+
204
+
205
+ /**
206
+ * @private Private initializiation.
207
+ */
208
+ protected function initialize() : void
209
+ {
210
+ _valid = false;
211
+ _relative = false;
212
+
213
+ _scheme = UNKNOWN_SCHEME;
214
+ _authority = "";
215
+ _username = "";
216
+ _password = "";
217
+ _port = "";
218
+ _path = "";
219
+ _query = "";
220
+ _fragment = "";
221
+
222
+ _nonHierarchical = "";
223
+ }
224
+
225
+ /**
226
+ * @private Accessor to explicitly set/get the hierarchical
227
+ * state of the URI.
228
+ */
229
+ protected function set hierState(state:Boolean) : void
230
+ {
231
+ if (state)
232
+ {
233
+ // Clear the non-hierarchical data
234
+ _nonHierarchical = "";
235
+
236
+ // Also set the state vars while we are at it
237
+ if (_scheme == "" || _scheme == UNKNOWN_SCHEME)
238
+ _relative = true;
239
+ else
240
+ _relative = false;
241
+
242
+ if (_authority.length == 0 && _path.length == 0)
243
+ _valid = false;
244
+ else
245
+ _valid = true;
246
+ }
247
+ else
248
+ {
249
+ // Clear the hierarchical data
250
+ _authority = "";
251
+ _username = "";
252
+ _password = "";
253
+ _port = "";
254
+ _path = "";
255
+
256
+ _relative = false;
257
+
258
+ if (_scheme == "" || _scheme == UNKNOWN_SCHEME)
259
+ _valid = false;
260
+ else
261
+ _valid = true;
262
+ }
263
+ }
264
+ protected function get hierState() : Boolean
265
+ {
266
+ return (_nonHierarchical.length == 0);
267
+ }
268
+
269
+
270
+ /**
271
+ * @private Functions that performs some basic consistency validation.
272
+ */
273
+ protected function validateURI() : Boolean
274
+ {
275
+ // Check the scheme
276
+ if (isAbsolute())
277
+ {
278
+ if (_scheme.length <= 1 || _scheme == UNKNOWN_SCHEME)
279
+ {
280
+ // we probably parsed a C:\ type path or no scheme
281
+ return false;
282
+ }
283
+ else if (verifyAlpha(_scheme) == false)
284
+ return false; // Scheme contains bad characters
285
+ }
286
+
287
+ if (hierState)
288
+ {
289
+ if (_path.search('\\') != -1)
290
+ return false; // local path
291
+ else if (isRelative() == false && _scheme == UNKNOWN_SCHEME)
292
+ return false; // It's an absolute URI, but it has a bad scheme
293
+ }
294
+ else
295
+ {
296
+ if (_nonHierarchical.search('\\') != -1)
297
+ return false; // some kind of local path
298
+ }
299
+
300
+ // Looks like it's ok.
301
+ return true;
302
+ }
303
+
304
+
305
+ /**
306
+ * @private
307
+ *
308
+ * Given a URI in string format, parse that sucker into its basic
309
+ * components and assign them to this object. A URI is of the form:
310
+ * <scheme>:<authority><path>?<query>#<fragment>
311
+ *
312
+ * For simplicity, we parse the URI in the following order:
313
+ *
314
+ * 1. Fragment (anchors)
315
+ * 2. Query (CGI stuff)
316
+ * 3. Scheme ("http")
317
+ * 4. Authority (host name)
318
+ * 5. Username/Password (if any)
319
+ * 6. Port (server port if any)
320
+ * 7. Path (/homepages/mypage.html)
321
+ *
322
+ * The reason for this order is to minimize any parsing ambiguities.
323
+ * Fragments and queries can contain almost anything (they are parts
324
+ * that can contain custom data with their own syntax). Parsing
325
+ * them out first removes a large chance of parsing errors. This
326
+ * method expects well formed URI's, but performing the parse in
327
+ * this order makes us a little more tolerant of user error.
328
+ *
329
+ * REGEXP
330
+ * Why doesn't this use regular expressions to parse the URI? We
331
+ * have found that in a real world scenario, URI's are not always
332
+ * well formed. Sometimes characters that should have been escaped
333
+ * are not, and those situations would break a regexp pattern. This
334
+ * function attempts to be smart about what it is parsing based on
335
+ * location of characters relative to eachother. This function has
336
+ * been proven through real-world use to parse the vast majority
337
+ * of URI's correctly.
338
+ *
339
+ * NOTE
340
+ * It is assumed that the string in URI form is escaped. This function
341
+ * does not escape anything. If you constructed the URI string by
342
+ * hand, and used this to parse in the URI and still need it escaped,
343
+ * call forceEscape() on your URI object.
344
+ *
345
+ * Parsing Assumptions
346
+ * This routine assumes that the URI being passed is well formed.
347
+ * Passing things like local paths, malformed URI's, and the such
348
+ * will result in parsing errors. This function can handle
349
+ * - absolute hierarchical (e.g. "http://something.com/index.html),
350
+ * - relative hierarchical (e.g. "../images/flower.gif"), or
351
+ * - non-hierarchical URIs (e.g. "mailto:jsmith@fungoo.com").
352
+ *
353
+ * Anything else will probably result in a parsing error, or a bogus
354
+ * URI object.
355
+ *
356
+ * Note that non-hierarchical URIs *MUST* have a scheme, otherwise
357
+ * they will be mistaken for relative URI's.
358
+ *
359
+ * If you are not sure what is being passed to you (like manually
360
+ * entered text from UI), you can construct a blank URI object and
361
+ * call unknownToURI() passing in the unknown string.
362
+ *
363
+ * @return true if successful, false if there was some kind of
364
+ * parsing error
365
+ */
366
+ protected function parseURI(uri:String) : Boolean
367
+ {
368
+ var baseURI:String = uri;
369
+ var index:int, index2:int;
370
+
371
+ // Make sure this object is clean before we start. If it was used
372
+ // before and we are now parsing a new URI, we don't want any stale
373
+ // info lying around.
374
+ initialize();
375
+
376
+ // Remove any fragments (anchors) from the URI
377
+ index = baseURI.indexOf("#");
378
+ if (index != -1)
379
+ {
380
+ // Store the fragment piece if any
381
+ if (baseURI.length > (index + 1)) // +1 is to skip the '#'
382
+ _fragment = baseURI.substr(index + 1, baseURI.length - (index + 1));
383
+
384
+ // Trim off the fragment
385
+ baseURI = baseURI.substr(0, index);
386
+ }
387
+
388
+ // We need to strip off any CGI parameters (eg '?param=bob')
389
+ index = baseURI.indexOf("?");
390
+ if (index != -1)
391
+ {
392
+ if (baseURI.length > (index + 1))
393
+ _query = baseURI.substr(index + 1, baseURI.length - (index + 1)); // +1 is to skip the '?'
394
+
395
+ // Trim off the query
396
+ baseURI = baseURI.substr(0, index);
397
+ }
398
+
399
+ // Now try to find the scheme part
400
+ index = baseURI.search(':');
401
+ index2 = baseURI.search('/');
402
+
403
+ var containsColon:Boolean = (index != -1);
404
+ var containsSlash:Boolean = (index2 != -1);
405
+
406
+ // This value is indeterminate if "containsColon" is false.
407
+ // (if there is no colon, does the slash come before or
408
+ // after said non-existing colon?)
409
+ var colonBeforeSlash:Boolean = (!containsSlash || index < index2);
410
+
411
+ // If it has a colon and it's before the first slash, we will treat
412
+ // it as a scheme. If a slash is before a colon, there must be a
413
+ // stray colon in a path or something. In which case, the colon is
414
+ // not the separator for the scheme. Technically, we could consider
415
+ // this an error, but since this is not an ambiguous state (we know
416
+ // 100% that this has no scheme), we will keep going.
417
+ if (containsColon && colonBeforeSlash)
418
+ {
419
+ // We found a scheme
420
+ _scheme = baseURI.substr(0, index);
421
+
422
+ // Normalize the scheme
423
+ _scheme = _scheme.toLowerCase();
424
+
425
+ baseURI = baseURI.substr(index + 1);
426
+
427
+ if (baseURI.substr(0, 2) == "//")
428
+ {
429
+ // This is a hierarchical URI
430
+ _nonHierarchical = "";
431
+
432
+ // Trim off the "//"
433
+ baseURI = baseURI.substr(2, baseURI.length - 2);
434
+ }
435
+ else
436
+ {
437
+ // This is a non-hierarchical URI like "mailto:bob@mail.com"
438
+ _nonHierarchical = baseURI;
439
+
440
+ if ((_valid = validateURI()) == false)
441
+ initialize(); // Bad URI. Clear it.
442
+
443
+ // No more parsing to do for this case
444
+ return isValid();
445
+ }
446
+ }
447
+ else
448
+ {
449
+ // No scheme. We will consider this a relative URI
450
+ _scheme = "";
451
+ _relative = true;
452
+ _nonHierarchical = "";
453
+ }
454
+
455
+ // Ok, what we have left is everything after the <scheme>://
456
+
457
+ // Now that we have stripped off any query and fragment parts, we
458
+ // need to split the authority from the path
459
+
460
+ if (isRelative())
461
+ {
462
+ // Don't bother looking for the authority. It's a relative URI
463
+ _authority = "";
464
+ _port = "";
465
+ _path = baseURI;
466
+ }
467
+ else
468
+ {
469
+ // Check for malformed UNC style file://///server/type/path/
470
+ // By the time we get here, we have already trimmed the "file://"
471
+ // so baseURI will be ///server/type/path. If baseURI only
472
+ // has one slash, we leave it alone because that is valid (that
473
+ // is the case of "file:///path/to/file.txt" where there is no
474
+ // server - implicit "localhost").
475
+ if (baseURI.substr(0, 2) == "//")
476
+ {
477
+ // Trim all leading slashes
478
+ while(baseURI.charAt(0) == "/")
479
+ baseURI = baseURI.substr(1, baseURI.length - 1);
480
+ }
481
+
482
+ index = baseURI.search('/');
483
+ if (index == -1)
484
+ {
485
+ // No path. We must have passed something like "http://something.com"
486
+ _authority = baseURI;
487
+ _path = "";
488
+ }
489
+ else
490
+ {
491
+ _authority = baseURI.substr(0, index);
492
+ _path = baseURI.substr(index, baseURI.length - index);
493
+ }
494
+
495
+ // Check to see if the URI has any username or password information.
496
+ // For example: ftp://username:password@server.com
497
+ index = _authority.search('@');
498
+ if (index != -1)
499
+ {
500
+ // We have a username and possibly a password
501
+ _username = _authority.substr(0, index);
502
+
503
+ // Remove the username/password from the authority
504
+ _authority = _authority.substr(index + 1); // Skip the '@'
505
+
506
+ // Now check to see if the username also has a password
507
+ index = _username.search(':');
508
+ if (index != -1)
509
+ {
510
+ _password = _username.substring(index + 1, _username.length);
511
+ _username = _username.substr(0, index);
512
+ }
513
+ else
514
+ _password = "";
515
+ }
516
+ else
517
+ {
518
+ _username = "";
519
+ _password = "";
520
+ }
521
+
522
+ // Lastly, check to see if the authorty has a port number.
523
+ // This is parsed after the username/password to avoid conflicting
524
+ // with the ':' in the 'username:password' if one exists.
525
+ index = _authority.search(':');
526
+ if (index != -1)
527
+ {
528
+ _port = _authority.substring(index + 1, _authority.length); // skip the ':'
529
+ _authority = _authority.substr(0, index);
530
+ }
531
+ else
532
+ {
533
+ _port = "";
534
+ }
535
+
536
+ // Lastly, normalize the authority. Domain names
537
+ // are case insensitive.
538
+ _authority = _authority.toLowerCase();
539
+ }
540
+
541
+ if ((_valid = validateURI()) == false)
542
+ initialize(); // Bad URI. Clear it
543
+
544
+ return isValid();
545
+ }
546
+
547
+
548
+ /********************************************************************
549
+ * Copy function.
550
+ */
551
+ public function copyURI(uri:URI) : void
552
+ {
553
+ this._scheme = uri._scheme;
554
+ this._authority = uri._authority;
555
+ this._username = uri._username;
556
+ this._password = uri._password;
557
+ this._port = uri._port;
558
+ this._path = uri._path;
559
+ this._query = uri._query;
560
+ this._fragment = uri._fragment;
561
+ this._nonHierarchical = uri._nonHierarchical;
562
+
563
+ this._valid = uri._valid;
564
+ this._relative = uri._relative;
565
+ }
566
+
567
+
568
+ /**
569
+ * @private
570
+ * Checks if the given string only contains a-z or A-Z.
571
+ */
572
+ protected function verifyAlpha(str:String) : Boolean
573
+ {
574
+ var pattern:RegExp = /[^a-z]/;
575
+ var index:int;
576
+
577
+ str = str.toLowerCase();
578
+ index = str.search(pattern);
579
+
580
+ if (index == -1)
581
+ return true;
582
+ else
583
+ return false;
584
+ }
585
+
586
+ /**
587
+ * Is this a valid URI?
588
+ *
589
+ * @return true if this object represents a valid URI, false
590
+ * otherwise.
591
+ */
592
+ public function isValid() : Boolean
593
+ {
594
+ return this._valid;
595
+ }
596
+
597
+
598
+ /**
599
+ * Is this URI an absolute URI? An absolute URI is a complete, fully
600
+ * qualified reference to a resource. e.g. http://site.com/index.htm
601
+ * Non-hierarchical URI's are always absolute.
602
+ */
603
+ public function isAbsolute() : Boolean
604
+ {
605
+ return !this._relative;
606
+ }
607
+
608
+
609
+ /**
610
+ * Is this URI a relative URI? Relative URI's do not have a scheme
611
+ * and only contain a relative path with optional anchor and query
612
+ * parts. e.g. "../reports/index.htm". Non-hierarchical URI's
613
+ * will never be relative.
614
+ */
615
+ public function isRelative() : Boolean
616
+ {
617
+ return this._relative;
618
+ }
619
+
620
+
621
+ /**
622
+ * Does this URI point to a resource that is a directory/folder?
623
+ * The URI specification dictates that any path that ends in a slash
624
+ * is a directory. This is needed to be able to perform correct path
625
+ * logic when combining relative URI's with absolute URI's to
626
+ * obtain the correct absolute URI to a resource.
627
+ *
628
+ * @see URI.chdir
629
+ *
630
+ * @return true if this URI represents a directory resource, false
631
+ * if this URI represents a file resource.
632
+ */
633
+ public function isDirectory() : Boolean
634
+ {
635
+ if (_path.length == 0)
636
+ return false;
637
+
638
+ return (_path.charAt(path.length - 1) == '/');
639
+ }
640
+
641
+
642
+ /**
643
+ * Is this URI a hierarchical URI? URI's can be
644
+ */
645
+ public function isHierarchical() : Boolean
646
+ {
647
+ return hierState;
648
+ }
649
+
650
+
651
+ /**
652
+ * The scheme of the URI.
653
+ */
654
+ public function get scheme() : String
655
+ {
656
+ return URI.unescapeChars(_scheme);
657
+ }
658
+ public function set scheme(schemeStr:String) : void
659
+ {
660
+ // Normalize the scheme
661
+ var normalized:String = schemeStr.toLowerCase();
662
+ _scheme = URI.fastEscapeChars(normalized, URI.URIschemeExcludedBitmap);
663
+ }
664
+
665
+
666
+ /**
667
+ * The authority (host) of the URI. Only valid for
668
+ * hierarchical URI's. If the URI is relative, this will
669
+ * be an empty string. When setting this value, the string
670
+ * given is assumed to be unescaped. When retrieving this
671
+ * value, the resulting string is unescaped.
672
+ */
673
+ public function get authority() : String
674
+ {
675
+ return URI.unescapeChars(_authority);
676
+ }
677
+ public function set authority(authorityStr:String) : void
678
+ {
679
+ // Normalize the authority
680
+ authorityStr = authorityStr.toLowerCase();
681
+
682
+ _authority = URI.fastEscapeChars(authorityStr,
683
+ URI.URIauthorityExcludedBitmap);
684
+
685
+ // Only hierarchical URI's can have an authority, make
686
+ // sure this URI is of the proper format.
687
+ this.hierState = true;
688
+ }
689
+
690
+
691
+ /**
692
+ * The username of the URI. Only valid for hierarchical
693
+ * URI's. If the URI is relative, this will be an empty
694
+ * string.
695
+ *
696
+ * <p>The URI specification allows for authentication
697
+ * credentials to be embedded in the URI as such:</p>
698
+ *
699
+ * <p>http://user:passwd&#64;host/path/to/file.htm</p>
700
+ *
701
+ * <p>When setting this value, the string
702
+ * given is assumed to be unescaped. When retrieving this
703
+ * value, the resulting string is unescaped.</p>
704
+ */
705
+ public function get username() : String
706
+ {
707
+ return URI.unescapeChars(_username);
708
+ }
709
+ public function set username(usernameStr:String) : void
710
+ {
711
+ _username = URI.fastEscapeChars(usernameStr, URI.URIuserpassExcludedBitmap);
712
+
713
+ // Only hierarchical URI's can have a username.
714
+ this.hierState = true;
715
+ }
716
+
717
+
718
+ /**
719
+ * The password of the URI. Similar to username.
720
+ * @see URI.username
721
+ */
722
+ public function get password() : String
723
+ {
724
+ return URI.unescapeChars(_password);
725
+ }
726
+ public function set password(passwordStr:String) : void
727
+ {
728
+ _password = URI.fastEscapeChars(passwordStr,
729
+ URI.URIuserpassExcludedBitmap);
730
+
731
+ // Only hierarchical URI's can have a password.
732
+ this.hierState = true;
733
+ }
734
+
735
+
736
+ /**
737
+ * The host port number. Only valid for hierarchical URI's. If
738
+ * the URI is relative, this will be an empty string. URI's can
739
+ * contain the port number of the remote host:
740
+ *
741
+ * <p>http://site.com:8080/index.htm</p>
742
+ */
743
+ public function get port() : String
744
+ {
745
+ return URI.unescapeChars(_port);
746
+ }
747
+ public function set port(portStr:String) : void
748
+ {
749
+ _port = URI.escapeChars(portStr);
750
+
751
+ // Only hierarchical URI's can have a port.
752
+ this.hierState = true;
753
+ }
754
+
755
+
756
+ /**
757
+ * The path portion of the URI. Only valid for hierarchical
758
+ * URI's. When setting this value, the string
759
+ * given is assumed to be unescaped. When retrieving this
760
+ * value, the resulting string is unescaped.
761
+ *
762
+ * <p>The path portion can be in one of two formats. 1) an absolute
763
+ * path, or 2) a relative path. An absolute path starts with a
764
+ * slash ('/'), a relative path does not.</p>
765
+ *
766
+ * <p>An absolute path may look like:</p>
767
+ * <listing>/full/path/to/my/file.htm</listing>
768
+ *
769
+ * <p>A relative path may look like:</p>
770
+ * <listing>
771
+ * path/to/my/file.htm
772
+ * ../images/logo.gif
773
+ * ../../reports/index.htm
774
+ * </listing>
775
+ *
776
+ * <p>Paths can be absolute or relative. Note that this not the same as
777
+ * an absolute or relative URI. An absolute URI can only have absolute
778
+ * paths. For example:</p>
779
+ *
780
+ * <listing>http:/site.com/path/to/file.htm</listing>
781
+ *
782
+ * <p>This absolute URI has an absolute path of "/path/to/file.htm".</p>
783
+ *
784
+ * <p>Relative URI's can have either absolute paths or relative paths.
785
+ * All of the following relative URI's are valid:</p>
786
+ *
787
+ * <listing>
788
+ * /absolute/path/to/file.htm
789
+ * path/to/file.htm
790
+ * ../path/to/file.htm
791
+ * </listing>
792
+ */
793
+ public function get path() : String
794
+ {
795
+ return URI.unescapeChars(_path);
796
+ }
797
+ public function set path(pathStr:String) : void
798
+ {
799
+ this._path = URI.fastEscapeChars(pathStr, URI.URIpathExcludedBitmap);
800
+
801
+ if (this._scheme == UNKNOWN_SCHEME)
802
+ {
803
+ // We set the path. This is a valid URI now.
804
+ this._scheme = "";
805
+ }
806
+
807
+ // Only hierarchical URI's can have a path.
808
+ hierState = true;
809
+ }
810
+
811
+
812
+ /**
813
+ * The query (CGI) portion of the URI. This part is valid for
814
+ * both hierarchical and non-hierarchical URI's.
815
+ *
816
+ * <p>This accessor should only be used if a custom query syntax
817
+ * is used. This URI class supports the common "param=value"
818
+ * style query syntax via the get/setQueryValue() and
819
+ * get/setQueryByMap() functions. Those functions should be used
820
+ * instead if the common syntax is being used.
821
+ *
822
+ * <p>The URI RFC does not specify any particular
823
+ * syntax for the query part of a URI. It is intended to allow
824
+ * any format that can be agreed upon by the two communicating hosts.
825
+ * However, most systems have standardized on the typical CGI
826
+ * format:</p>
827
+ *
828
+ * <listing>http://site.com/script.php?param1=value1&param2=value2</listing>
829
+ *
830
+ * <p>This class has specific support for this query syntax</p>
831
+ *
832
+ * <p>This common query format is an array of name/value
833
+ * pairs with its own syntax that is different from the overall URI
834
+ * syntax. The query has its own escaping logic. For a query part
835
+ * to be properly escaped and unescaped, it must be split into its
836
+ * component parts. This accessor escapes/unescapes the entire query
837
+ * part without regard for it's component parts. This has the
838
+ * possibliity of leaving the query string in an ambiguious state in
839
+ * regards to its syntax. If the contents of the query part are
840
+ * important, it is recommended that get/setQueryValue() or
841
+ * get/setQueryByMap() are used instead.</p>
842
+ *
843
+ * If a different query syntax is being used, a subclass of URI
844
+ * can be created to handle that specific syntax.
845
+ *
846
+ * @see URI.getQueryValue, URI.getQueryByMap
847
+ */
848
+ public function get query() : String
849
+ {
850
+ return URI.unescapeChars(_query);
851
+ }
852
+ public function set query(queryStr:String) : void
853
+ {
854
+ _query = URI.fastEscapeChars(queryStr, URI.URIqueryExcludedBitmap);
855
+
856
+ // both hierarchical and non-hierarchical URI's can
857
+ // have a query. Do not set the hierState.
858
+ }
859
+
860
+ /**
861
+ * Accessor to the raw query data. If you are using a custom query
862
+ * syntax, this accessor can be used to get and set the query part
863
+ * directly with no escaping/unescaping. This should ONLY be used
864
+ * if your application logic is handling custom query logic and
865
+ * handling the proper escaping of the query part.
866
+ */
867
+ public function get queryRaw() : String
868
+ {
869
+ return _query;
870
+ }
871
+ public function set queryRaw(queryStr:String) : void
872
+ {
873
+ _query = queryStr;
874
+ }
875
+
876
+
877
+ /**
878
+ * The fragment (anchor) portion of the URI. This is valid for
879
+ * both hierarchical and non-hierarchical URI's.
880
+ */
881
+ public function get fragment() : String
882
+ {
883
+ return URI.unescapeChars(_fragment);
884
+ }
885
+ public function set fragment(fragmentStr:String) : void
886
+ {
887
+ _fragment = URI.fastEscapeChars(fragmentStr, URIfragmentExcludedBitmap);
888
+
889
+ // both hierarchical and non-hierarchical URI's can
890
+ // have a fragment. Do not set the hierState.
891
+ }
892
+
893
+
894
+ /**
895
+ * The non-hierarchical part of the URI. For example, if
896
+ * this URI object represents "mailto:somebody@company.com",
897
+ * this will contain "somebody@company.com". This is valid only
898
+ * for non-hierarchical URI's.
899
+ */
900
+ public function get nonHierarchical() : String
901
+ {
902
+ return URI.unescapeChars(_nonHierarchical);
903
+ }
904
+ public function set nonHierarchical(nonHier:String) : void
905
+ {
906
+ _nonHierarchical = URI.fastEscapeChars(nonHier, URInonHierexcludedBitmap);
907
+
908
+ // This is a non-hierarchical URI.
909
+ this.hierState = false;
910
+ }
911
+
912
+
913
+ /**
914
+ * Quick shorthand accessor to set the parts of this URI.
915
+ * The given parts are assumed to be in unescaped form. If
916
+ * the URI is non-hierarchical (e.g. mailto:) you will need
917
+ * to call SetScheme() and SetNonHierarchical().
918
+ */
919
+ public function setParts(schemeStr:String, authorityStr:String,
920
+ portStr:String, pathStr:String, queryStr:String,
921
+ fragmentStr:String) : void
922
+ {
923
+ this.scheme = schemeStr;
924
+ this.authority = authorityStr;
925
+ this.port = portStr;
926
+ this.path = pathStr;
927
+ this.query = queryStr;
928
+ this.fragment = fragmentStr;
929
+
930
+ hierState = true;
931
+ }
932
+
933
+
934
+ /**
935
+ * URI escapes the given character string. This is similar in function
936
+ * to the global encodeURIComponent() function in ActionScript, but is
937
+ * slightly different in regards to which characters get escaped. This
938
+ * escapes the characters specified in the URIbaselineExluded set (see class
939
+ * static members). This is needed for this class to work properly.
940
+ *
941
+ * <p>If a different set of characters need to be used for the escaping,
942
+ * you may use fastEscapeChars() and specify a custom URIEncodingBitmap
943
+ * that contains the characters your application needs escaped.</p>
944
+ *
945
+ * <p>Never pass a full URI to this function. A URI can only be properly
946
+ * escaped/unescaped when split into its component parts (see RFC 3986
947
+ * section 2.4). This is due to the fact that the URI component separators
948
+ * could be characters that would normally need to be escaped.</p>
949
+ *
950
+ * @param unescaped character string to be escaped.
951
+ *
952
+ * @return escaped character string
953
+ *
954
+ * @see encodeURIComponent
955
+ * @see fastEscapeChars
956
+ */
957
+ static public function escapeChars(unescaped:String) : String
958
+ {
959
+ // This uses the excluded set by default.
960
+ return fastEscapeChars(unescaped, URI.URIbaselineExcludedBitmap);
961
+ }
962
+
963
+
964
+ /**
965
+ * Unescape any URI escaped characters in the given character
966
+ * string.
967
+ *
968
+ * <p>Never pass a full URI to this function. A URI can only be properly
969
+ * escaped/unescaped when split into its component parts (see RFC 3986
970
+ * section 2.4). This is due to the fact that the URI component separators
971
+ * could be characters that would normally need to be escaped.</p>
972
+ *
973
+ * @param escaped the escaped string to be unescaped.
974
+ *
975
+ * @return unescaped string.
976
+ */
977
+ static public function unescapeChars(escaped:String /*, onlyHighASCII:Boolean = false*/) : String
978
+ {
979
+ // We can just use the default AS function. It seems to
980
+ // decode everything correctly
981
+ var unescaped:String;
982
+ unescaped = decodeURIComponent(escaped);
983
+ return unescaped;
984
+ }
985
+
986
+ /**
987
+ * Performance focused function that escapes the given character
988
+ * string using the given URIEncodingBitmap as the rule for what
989
+ * characters need to be escaped. This function is used by this
990
+ * class and can be used externally to this class to perform
991
+ * escaping on custom character sets.
992
+ *
993
+ * <p>Never pass a full URI to this function. A URI can only be properly
994
+ * escaped/unescaped when split into its component parts (see RFC 3986
995
+ * section 2.4). This is due to the fact that the URI component separators
996
+ * could be characters that would normally need to be escaped.</p>
997
+ *
998
+ * @param unescaped the unescaped string to be escaped
999
+ * @param bitmap the set of characters that need to be escaped
1000
+ *
1001
+ * @return the escaped string.
1002
+ */
1003
+ static public function fastEscapeChars(unescaped:String, bitmap:URIEncodingBitmap) : String
1004
+ {
1005
+ var escaped:String = "";
1006
+ var c:String;
1007
+ var x:int, i:int;
1008
+
1009
+ for (i = 0; i < unescaped.length; i++)
1010
+ {
1011
+ c = unescaped.charAt(i);
1012
+
1013
+ x = bitmap.ShouldEscape(c);
1014
+ if (x)
1015
+ {
1016
+ c = x.toString(16);
1017
+ if (c.length == 1)
1018
+ c = "0" + c;
1019
+
1020
+ c = "%" + c;
1021
+ c = c.toUpperCase();
1022
+ }
1023
+
1024
+ escaped += c;
1025
+ }
1026
+
1027
+ return escaped;
1028
+ }
1029
+
1030
+
1031
+ /**
1032
+ * Is this URI of a particular scheme type? For example,
1033
+ * passing "http" to a URI object that represents the URI
1034
+ * "http://site.com/" would return true.
1035
+ *
1036
+ * @param scheme scheme to check for
1037
+ *
1038
+ * @return true if this URI object is of the given type, false
1039
+ * otherwise.
1040
+ */
1041
+ public function isOfType(scheme:String) : Boolean
1042
+ {
1043
+ // Schemes are never case sensitive. Ignore case.
1044
+ scheme = scheme.toLowerCase();
1045
+ return (this._scheme == scheme);
1046
+ }
1047
+
1048
+
1049
+ /**
1050
+ * Get the value for the specified named in the query part. This
1051
+ * assumes the query part of the URI is in the common
1052
+ * "name1=value1&name2=value2" syntax. Do not call this function
1053
+ * if you are using a custom query syntax.
1054
+ *
1055
+ * @param name name of the query value to get.
1056
+ *
1057
+ * @return the value of the query name, empty string if the
1058
+ * query name does not exist.
1059
+ */
1060
+ public function getQueryValue(name:String) : String
1061
+ {
1062
+ var map:Object;
1063
+ var item:String;
1064
+ var value:String;
1065
+
1066
+ map = getQueryByMap();
1067
+
1068
+ for (item in map)
1069
+ {
1070
+ if (item == name)
1071
+ {
1072
+ value = map[item];
1073
+ return value;
1074
+ }
1075
+ }
1076
+
1077
+ // Didn't find the specified key
1078
+ return new String("");
1079
+ }
1080
+
1081
+
1082
+ /**
1083
+ * Set the given value on the given query name. If the given name
1084
+ * does not exist, it will automatically add this name/value pair
1085
+ * to the query. If null is passed as the value, it will remove
1086
+ * the given item from the query.
1087
+ *
1088
+ * <p>This automatically escapes any characters that may conflict with
1089
+ * the query syntax so that they are "safe" within the query. The
1090
+ * strings passed are assumed to be literal unescaped name and value.</p>
1091
+ *
1092
+ * @param name name of the query value to set
1093
+ * @param value value of the query item to set. If null, this will
1094
+ * force the removal of this item from the query.
1095
+ */
1096
+ public function setQueryValue(name:String, value:String) : void
1097
+ {
1098
+ var map:Object;
1099
+
1100
+ map = getQueryByMap();
1101
+
1102
+ // If the key doesn't exist yet, this will create a new pair in
1103
+ // the map. If it does exist, this will overwrite the previous
1104
+ // value, which is what we want.
1105
+ map[name] = value;
1106
+
1107
+ setQueryByMap(map);
1108
+ }
1109
+
1110
+
1111
+ /**
1112
+ * Get the query of the URI in an Object class that allows for easy
1113
+ * access to the query data via Object accessors. For example:
1114
+ *
1115
+ * <listing>
1116
+ * var query:Object = uri.getQueryByMap();
1117
+ * var value:String = query["param"]; // get a value
1118
+ * query["param2"] = "foo"; // set a new value
1119
+ * </listing>
1120
+ *
1121
+ * @return Object that contains the name/value pairs of the query.
1122
+ *
1123
+ * @see #setQueryByMap
1124
+ * @see #getQueryValue
1125
+ * @see #setQueryValue
1126
+ */
1127
+ public function getQueryByMap() : Object
1128
+ {
1129
+ var queryStr:String;
1130
+ var pair:String;
1131
+ var pairs:Array;
1132
+ var item:Array;
1133
+ var name:String, value:String;
1134
+ var index:int;
1135
+ var map:Object = new Object();
1136
+
1137
+
1138
+ // We need the raw query string, no unescaping.
1139
+ queryStr = this._query;
1140
+
1141
+ pairs = queryStr.split('&');
1142
+ for each (pair in pairs)
1143
+ {
1144
+ if (pair.length == 0)
1145
+ continue;
1146
+
1147
+ item = pair.split('=');
1148
+
1149
+ if (item.length > 0)
1150
+ name = item[0];
1151
+ else
1152
+ continue; // empty array
1153
+
1154
+ if (item.length > 1)
1155
+ value = item[1];
1156
+ else
1157
+ value = "";
1158
+
1159
+ name = queryPartUnescape(name);
1160
+ value = queryPartUnescape(value);
1161
+
1162
+ map[name] = value;
1163
+ }
1164
+
1165
+ return map;
1166
+ }
1167
+
1168
+
1169
+ /**
1170
+ * Set the query part of this URI using the given object as the
1171
+ * content source. Any member of the object that has a value of
1172
+ * null will not be in the resulting query.
1173
+ *
1174
+ * @param map object that contains the name/value pairs as
1175
+ * members of that object.
1176
+ *
1177
+ * @see #getQueryByMap
1178
+ * @see #getQueryValue
1179
+ * @see #setQueryValue
1180
+ */
1181
+ public function setQueryByMap(map:Object) : void
1182
+ {
1183
+ var item:String;
1184
+ var name:String, value:String;
1185
+ var queryStr:String = "";
1186
+ var tmpPair:String;
1187
+ var foo:String;
1188
+
1189
+ for (item in map)
1190
+ {
1191
+ name = item;
1192
+ value = map[item];
1193
+
1194
+ if (value == null)
1195
+ value = "";
1196
+
1197
+ // Need to escape the name/value pair so that they
1198
+ // don't conflict with the query syntax (specifically
1199
+ // '=', '&', and <whitespace>).
1200
+ name = queryPartEscape(name);
1201
+ value = queryPartEscape(value);
1202
+
1203
+ tmpPair = name;
1204
+
1205
+ if (value.length > 0)
1206
+ {
1207
+ tmpPair += "=";
1208
+ tmpPair += value;
1209
+ }
1210
+
1211
+ if (queryStr.length != 0)
1212
+ queryStr += '&'; // Add the separator
1213
+
1214
+ queryStr += tmpPair;
1215
+ }
1216
+
1217
+ // We don't want to escape. We already escaped the
1218
+ // individual name/value pairs. If we escaped the
1219
+ // query string again by assigning it to "query",
1220
+ // we would have double escaping.
1221
+ _query = queryStr;
1222
+ }
1223
+
1224
+
1225
+ /**
1226
+ * Similar to Escape(), except this also escapes characters that
1227
+ * would conflict with the name/value pair query syntax. This is
1228
+ * intended to be called on each individual "name" and "value"
1229
+ * in the query making sure that nothing in the name or value
1230
+ * strings contain characters that would conflict with the query
1231
+ * syntax (e.g. '=' and '&').
1232
+ *
1233
+ * @param unescaped unescaped string that is to be escaped.
1234
+ *
1235
+ * @return escaped string.
1236
+ *
1237
+ * @see #queryUnescape
1238
+ */
1239
+ static public function queryPartEscape(unescaped:String) : String
1240
+ {
1241
+ var escaped:String = unescaped;
1242
+ escaped = URI.fastEscapeChars(unescaped, URI.URIqueryPartExcludedBitmap);
1243
+ return escaped;
1244
+ }
1245
+
1246
+
1247
+ /**
1248
+ * Unescape the individual name/value string pairs.
1249
+ *
1250
+ * @param escaped escaped string to be unescaped
1251
+ *
1252
+ * @return unescaped string
1253
+ *
1254
+ * @see #queryEscape
1255
+ */
1256
+ static public function queryPartUnescape(escaped:String) : String
1257
+ {
1258
+ var unescaped:String = escaped;
1259
+ unescaped = unescapeChars(unescaped);
1260
+ return unescaped;
1261
+ }
1262
+
1263
+ /**
1264
+ * Output this URI as a string. The resulting string is properly
1265
+ * escaped and well formed for machine processing.
1266
+ */
1267
+ public function toString() : String
1268
+ {
1269
+ if (this == null)
1270
+ return "";
1271
+ else
1272
+ return toStringInternal(false);
1273
+ }
1274
+
1275
+ /**
1276
+ * Output the URI as a string that is easily readable by a human.
1277
+ * This outputs the URI with all escape sequences unescaped to
1278
+ * their character representation. This makes the URI easier for
1279
+ * a human to read, but the URI could be completely invalid
1280
+ * because some unescaped characters may now cause ambiguous parsing.
1281
+ * This function should only be used if you want to display a URI to
1282
+ * a user. This function should never be used outside that specific
1283
+ * case.
1284
+ *
1285
+ * @return the URI in string format with all escape sequences
1286
+ * unescaped.
1287
+ *
1288
+ * @see #toString
1289
+ */
1290
+ public function toDisplayString() : String
1291
+ {
1292
+ return toStringInternal(true);
1293
+ }
1294
+
1295
+
1296
+ /**
1297
+ * @private
1298
+ *
1299
+ * The guts of toString()
1300
+ */
1301
+ protected function toStringInternal(forDisplay:Boolean) : String
1302
+ {
1303
+ var uri:String = "";
1304
+ var part:String = "";
1305
+
1306
+ if (isHierarchical() == false)
1307
+ {
1308
+ // non-hierarchical URI
1309
+
1310
+ uri += (forDisplay ? this.scheme : _scheme);
1311
+ uri += ":";
1312
+ uri += (forDisplay ? this.nonHierarchical : _nonHierarchical);
1313
+ }
1314
+ else
1315
+ {
1316
+ // Hierarchical URI
1317
+
1318
+ if (isRelative() == false)
1319
+ {
1320
+ // If it is not a relative URI, then we want the scheme and
1321
+ // authority parts in the string. If it is relative, we
1322
+ // do NOT want this stuff.
1323
+
1324
+ if (_scheme.length != 0)
1325
+ {
1326
+ part = (forDisplay ? this.scheme : _scheme);
1327
+ uri += part + ":";
1328
+ }
1329
+
1330
+ if (_authority.length != 0 || isOfType("file"))
1331
+ {
1332
+ uri += "//";
1333
+
1334
+ // Add on any username/password associated with this
1335
+ // authority
1336
+ if (_username.length != 0)
1337
+ {
1338
+ part = (forDisplay ? this.username : _username);
1339
+ uri += part;
1340
+
1341
+ if (_password.length != 0)
1342
+ {
1343
+ part = (forDisplay ? this.password : _password);
1344
+ uri += ":" + part;
1345
+ }
1346
+
1347
+ uri += "@";
1348
+ }
1349
+
1350
+ // add the authority
1351
+ part = (forDisplay ? this.authority : _authority);
1352
+ uri += part;
1353
+
1354
+ // Tack on the port number, if any
1355
+ if (port.length != 0)
1356
+ uri += ":" + port;
1357
+ }
1358
+ }
1359
+
1360
+ // Tack on the path
1361
+ part = (forDisplay ? this.path : _path);
1362
+ uri += part;
1363
+
1364
+ } // end hierarchical part
1365
+
1366
+ // Both non-hier and hierarchical have query and fragment parts
1367
+
1368
+ // Add on the query and fragment parts
1369
+ if (_query.length != 0)
1370
+ {
1371
+ part = (forDisplay ? this.query : _query);
1372
+ uri += "?" + part;
1373
+ }
1374
+
1375
+ if (fragment.length != 0)
1376
+ {
1377
+ part = (forDisplay ? this.fragment : _fragment);
1378
+ uri += "#" + part;
1379
+ }
1380
+
1381
+ return uri;
1382
+ }
1383
+
1384
+ /**
1385
+ * Forcefully ensure that this URI is properly escaped.
1386
+ *
1387
+ * <p>Sometimes URI's are constructed by hand using strings outside
1388
+ * this class. In those cases, it is unlikely the URI has been
1389
+ * properly escaped. This function forcefully escapes this URI
1390
+ * by unescaping each part and then re-escaping it. If the URI
1391
+ * did not have any escaping, the first unescape will do nothing
1392
+ * and then the re-escape will properly escape everything. If
1393
+ * the URI was already escaped, the unescape and re-escape will
1394
+ * essentally be a no-op. This provides a safe way to make sure
1395
+ * a URI is in the proper escaped form.</p>
1396
+ */
1397
+ public function forceEscape() : void
1398
+ {
1399
+ // The accessors for each of the members will unescape
1400
+ // and then re-escape as we get and assign them.
1401
+
1402
+ // Handle the parts that are common for both hierarchical
1403
+ // and non-hierarchical URI's
1404
+ this.scheme = this.scheme;
1405
+ this.setQueryByMap(this.getQueryByMap());
1406
+ this.fragment = this.fragment;
1407
+
1408
+ if (isHierarchical())
1409
+ {
1410
+ this.authority = this.authority;
1411
+ this.path = this.path;
1412
+ this.port = this.port;
1413
+ this.username = this.username;
1414
+ this.password = this.password;
1415
+ }
1416
+ else
1417
+ {
1418
+ this.nonHierarchical = this.nonHierarchical;
1419
+ }
1420
+ }
1421
+
1422
+
1423
+ /**
1424
+ * Does this URI point to a resource of the given file type?
1425
+ * Given a file extension (or just a file name, this will strip the
1426
+ * extension), check to see if this URI points to a file of that
1427
+ * type.
1428
+ *
1429
+ * @param extension string that contains a file extension with or
1430
+ * without a dot ("html" and ".html" are both valid), or a file
1431
+ * name with an extension (e.g. "index.html").
1432
+ *
1433
+ * @return true if this URI points to a resource with the same file
1434
+ * file extension as the extension provided, false otherwise.
1435
+ */
1436
+ public function isOfFileType(extension:String) : Boolean
1437
+ {
1438
+ var thisExtension:String;
1439
+ var index:int;
1440
+
1441
+ index = extension.lastIndexOf(".");
1442
+ if (index != -1)
1443
+ {
1444
+ // Strip the extension
1445
+ extension = extension.substr(index + 1);
1446
+ }
1447
+ else
1448
+ {
1449
+ // The caller passed something without a dot in it. We
1450
+ // will assume that it is just a plain extension (e.g. "html").
1451
+ // What they passed is exactly what we want
1452
+ }
1453
+
1454
+ thisExtension = getExtension(true);
1455
+
1456
+ if (thisExtension == "")
1457
+ return false;
1458
+
1459
+ // Compare the extensions ignoring case
1460
+ if (compareStr(thisExtension, extension, false) == 0)
1461
+ return true;
1462
+ else
1463
+ return false;
1464
+ }
1465
+
1466
+
1467
+ /**
1468
+ * Get the ".xyz" file extension from the filename in the URI.
1469
+ * For example, if we have the following URI:
1470
+ *
1471
+ * <listing>http://something.com/path/to/my/page.html?form=yes&name=bob#anchor</listing>
1472
+ *
1473
+ * <p>This will return ".html".</p>
1474
+ *
1475
+ * @param minusDot If true, this will strip the dot from the extension.
1476
+ * If true, the above example would have returned "html".
1477
+ *
1478
+ * @return the file extension
1479
+ */
1480
+ public function getExtension(minusDot:Boolean = false) : String
1481
+ {
1482
+ var filename:String = getFilename();
1483
+ var extension:String;
1484
+ var index:int;
1485
+
1486
+ if (filename == "")
1487
+ return String("");
1488
+
1489
+ index = filename.lastIndexOf(".");
1490
+
1491
+ // If it doesn't have an extension, or if it is a "hidden" file,
1492
+ // it doesn't have an extension. Hidden files on unix start with
1493
+ // a dot (e.g. ".login").
1494
+ if (index == -1 || index == 0)
1495
+ return String("");
1496
+
1497
+ extension = filename.substr(index);
1498
+
1499
+ // If the caller does not want the dot, remove it.
1500
+ if (minusDot && extension.charAt(0) == ".")
1501
+ extension = extension.substr(1);
1502
+
1503
+ return extension;
1504
+ }
1505
+
1506
+ /**
1507
+ * Quick function to retrieve the file name off the end of a URI.
1508
+ *
1509
+ * <p>For example, if the URI is:</p>
1510
+ * <listing>http://something.com/some/path/to/my/file.html</listing>
1511
+ * <p>this function will return "file.html".</p>
1512
+ *
1513
+ * @param minusExtension true if the file extension should be stripped
1514
+ *
1515
+ * @return the file name. If this URI is a directory, the return
1516
+ * value will be empty string.
1517
+ */
1518
+ public function getFilename(minusExtension:Boolean = false) : String
1519
+ {
1520
+ if (isDirectory())
1521
+ return String("");
1522
+
1523
+ var pathStr:String = this.path;
1524
+ var filename:String;
1525
+ var index:int;
1526
+
1527
+ // Find the last path separator.
1528
+ index = pathStr.lastIndexOf("/");
1529
+
1530
+ if (index != -1)
1531
+ filename = pathStr.substr(index + 1);
1532
+ else
1533
+ filename = pathStr;
1534
+
1535
+ if (minusExtension)
1536
+ {
1537
+ // The caller has requested that the extension be removed
1538
+ index = filename.lastIndexOf(".");
1539
+
1540
+ if (index != -1)
1541
+ filename = filename.substr(0, index);
1542
+ }
1543
+
1544
+ return filename;
1545
+ }
1546
+
1547
+
1548
+ /**
1549
+ * @private
1550
+ * Helper function to compare strings.
1551
+ *
1552
+ * @return true if the two strings are identical, false otherwise.
1553
+ */
1554
+ static protected function compareStr(str1:String, str2:String,
1555
+ sensitive:Boolean = true) : Boolean
1556
+ {
1557
+ if (sensitive == false)
1558
+ {
1559
+ str1 = str1.toLowerCase();
1560
+ str2 = str2.toLowerCase();
1561
+ }
1562
+
1563
+ return (str1 == str2)
1564
+ }
1565
+
1566
+ /**
1567
+ * Based on the type of this URI (http, ftp, etc.) get
1568
+ * the default port used for that protocol. This is
1569
+ * just intended to be a helper function for the most
1570
+ * common cases.
1571
+ */
1572
+ public function getDefaultPort() : String
1573
+ {
1574
+ if (_scheme == "http")
1575
+ return String("80");
1576
+ else if (_scheme == "ftp")
1577
+ return String("21");
1578
+ else if (_scheme == "file")
1579
+ return String("");
1580
+ else if (_scheme == "sftp")
1581
+ return String("22"); // ssh standard port
1582
+ else
1583
+ {
1584
+ // Don't know the port for this URI type
1585
+ return String("");
1586
+ }
1587
+ }
1588
+
1589
+ /**
1590
+ * @private
1591
+ *
1592
+ * This resolves the given URI if the application has a
1593
+ * resolver interface defined. This function does not
1594
+ * modify the passed in URI and returns a new URI.
1595
+ */
1596
+ static protected function resolve(uri:URI) : URI
1597
+ {
1598
+ var copy:URI = new URI();
1599
+ copy.copyURI(uri);
1600
+
1601
+ if (_resolver != null)
1602
+ {
1603
+ // A resolver class has been registered. Call it.
1604
+ return _resolver.resolve(copy);
1605
+ }
1606
+ else
1607
+ {
1608
+ // No resolver. Nothing to do, but we don't
1609
+ // want to reuse the one passed in.
1610
+ return copy;
1611
+ }
1612
+ }
1613
+
1614
+ /**
1615
+ * Accessor to set and get the resolver object used by all URI
1616
+ * objects to dynamically resolve URI's before comparison.
1617
+ */
1618
+ static public function set resolver(resolver:IURIResolver) : void
1619
+ {
1620
+ _resolver = resolver;
1621
+ }
1622
+ static public function get resolver() : IURIResolver
1623
+ {
1624
+ return _resolver;
1625
+ }
1626
+
1627
+ /**
1628
+ * Given another URI, return this URI object's relation to the one given.
1629
+ * URI's can have 1 of 4 possible relationships. They can be unrelated,
1630
+ * equal, parent, or a child of the given URI.
1631
+ *
1632
+ * @param uri URI to compare this URI object to.
1633
+ * @param caseSensitive true if the URI comparison should be done
1634
+ * taking case into account, false if the comparison should be
1635
+ * performed case insensitive.
1636
+ *
1637
+ * @return URI.NOT_RELATED, URI.CHILD, URI.PARENT, or URI.EQUAL
1638
+ */
1639
+ public function getRelation(uri:URI, caseSensitive:Boolean = true) : int
1640
+ {
1641
+ // Give the app a chance to resolve these URI's before we compare them.
1642
+ var thisURI:URI = URI.resolve(this);
1643
+ var thatURI:URI = URI.resolve(uri);
1644
+
1645
+ if (thisURI.isRelative() || thatURI.isRelative())
1646
+ {
1647
+ // You cannot compare relative URI's due to their lack of context.
1648
+ // You could have two relative URI's that look like:
1649
+ // ../../images/
1650
+ // ../../images/marketing/logo.gif
1651
+ // These may appear related, but you have no overall context
1652
+ // from which to make the comparison. The first URI could be
1653
+ // from one site and the other URI could be from another site.
1654
+ return URI.NOT_RELATED;
1655
+ }
1656
+ else if (thisURI.isHierarchical() == false || thatURI.isHierarchical() == false)
1657
+ {
1658
+ // One or both of the URI's are non-hierarchical.
1659
+ if (((thisURI.isHierarchical() == false) && (thatURI.isHierarchical() == true)) ||
1660
+ ((thisURI.isHierarchical() == true) && (thatURI.isHierarchical() == false)))
1661
+ {
1662
+ // XOR. One is hierarchical and the other is
1663
+ // non-hierarchical. They cannot be compared.
1664
+ return URI.NOT_RELATED;
1665
+ }
1666
+ else
1667
+ {
1668
+ // They are both non-hierarchical
1669
+ if (thisURI.scheme != thatURI.scheme)
1670
+ return URI.NOT_RELATED;
1671
+
1672
+ if (thisURI.nonHierarchical != thatURI.nonHierarchical)
1673
+ return URI.NOT_RELATED;
1674
+
1675
+ // The two non-hierarcical URI's are equal.
1676
+ return URI.EQUAL;
1677
+ }
1678
+ }
1679
+
1680
+ // Ok, this URI and the one we are being compared to are both
1681
+ // absolute hierarchical URI's.
1682
+
1683
+ if (thisURI.scheme != thatURI.scheme)
1684
+ return URI.NOT_RELATED;
1685
+
1686
+ if (thisURI.authority != thatURI.authority)
1687
+ return URI.NOT_RELATED;
1688
+
1689
+ var thisPort:String = thisURI.port;
1690
+ var thatPort:String = thatURI.port;
1691
+
1692
+ // Different ports are considered completely different servers.
1693
+ if (thisPort == "")
1694
+ thisPort = thisURI.getDefaultPort();
1695
+ if (thatPort == "")
1696
+ thatPort = thatURI.getDefaultPort();
1697
+
1698
+ // Check to see if the port is the default port.
1699
+ if (thisPort != thatPort)
1700
+ return URI.NOT_RELATED;
1701
+
1702
+ if (compareStr(thisURI.path, thatURI.path, caseSensitive))
1703
+ return URI.EQUAL;
1704
+
1705
+ // Special case check. If we are here, the scheme, authority,
1706
+ // and port match, and it is not a relative path, but the
1707
+ // paths did not match. There is a special case where we
1708
+ // could have:
1709
+ // http://something.com/
1710
+ // http://something.com
1711
+ // Technically, these are equal. So lets, check for this case.
1712
+ var thisPath:String = thisURI.path;
1713
+ var thatPath:String = thatURI.path;
1714
+
1715
+ if ( (thisPath == "/" || thatPath == "/") &&
1716
+ (thisPath == "" || thatPath == "") )
1717
+ {
1718
+ // We hit the special case. These two are equal.
1719
+ return URI.EQUAL;
1720
+ }
1721
+
1722
+ // Ok, the paths do not match, but one path may be a parent/child
1723
+ // of the other. For example, we may have:
1724
+ // http://something.com/path/to/homepage/
1725
+ // http://something.com/path/to/homepage/images/logo.gif
1726
+ // In this case, the first is a parent of the second (or the second
1727
+ // is a child of the first, depending on which you compare to the
1728
+ // other). To make this comparison, we must split the path into
1729
+ // its component parts (split the string on the '/' path delimiter).
1730
+ // We then compare the
1731
+ var thisParts:Array, thatParts:Array;
1732
+ var thisPart:String, thatPart:String;
1733
+ var i:int;
1734
+
1735
+ thisParts = thisPath.split("/");
1736
+ thatParts = thatPath.split("/");
1737
+
1738
+ if (thisParts.length > thatParts.length)
1739
+ {
1740
+ thatPart = thatParts[thatParts.length - 1];
1741
+ if (thatPart.length > 0)
1742
+ {
1743
+ // if the last part is not empty, the passed URI is
1744
+ // not a directory. There is no way the passed URI
1745
+ // can be a parent.
1746
+ return URI.NOT_RELATED;
1747
+ }
1748
+ else
1749
+ {
1750
+ // Remove the empty trailing part
1751
+ thatParts.pop();
1752
+ }
1753
+
1754
+ // This may be a child of the one passed in
1755
+ for (i = 0; i < thatParts.length; i++)
1756
+ {
1757
+ thisPart = thisParts[i];
1758
+ thatPart = thatParts[i];
1759
+
1760
+ if (compareStr(thisPart, thatPart, caseSensitive) == false)
1761
+ return URI.NOT_RELATED;
1762
+ }
1763
+
1764
+ return URI.CHILD;
1765
+ }
1766
+ else if (thisParts.length < thatParts.length)
1767
+ {
1768
+ thisPart = thisParts[thisParts.length - 1];
1769
+ if (thisPart.length > 0)
1770
+ {
1771
+ // if the last part is not empty, this URI is not a
1772
+ // directory. There is no way this object can be
1773
+ // a parent.
1774
+ return URI.NOT_RELATED;
1775
+ }
1776
+ else
1777
+ {
1778
+ // Remove the empty trailing part
1779
+ thisParts.pop();
1780
+ }
1781
+
1782
+ // This may be the parent of the one passed in
1783
+ for (i = 0; i < thisParts.length; i++)
1784
+ {
1785
+ thisPart = thisParts[i];
1786
+ thatPart = thatParts[i];
1787
+
1788
+ if (compareStr(thisPart, thatPart, caseSensitive) == false)
1789
+ return URI.NOT_RELATED;
1790
+ }
1791
+
1792
+ return URI.PARENT;
1793
+ }
1794
+ else
1795
+ {
1796
+ // Both URI's have the same number of path components, but
1797
+ // it failed the equivelence check above. This means that
1798
+ // the two URI's are not related.
1799
+ return URI.NOT_RELATED;
1800
+ }
1801
+
1802
+ // If we got here, the scheme and authority are the same,
1803
+ // but the paths pointed to two different locations that
1804
+ // were in different parts of the file system tree
1805
+ return URI.NOT_RELATED;
1806
+ }
1807
+
1808
+ /**
1809
+ * Given another URI, return the common parent between this one
1810
+ * and the provided URI.
1811
+ *
1812
+ * @param uri the other URI from which to find a common parent
1813
+ * @para caseSensitive true if this operation should be done
1814
+ * with case sensitive comparisons.
1815
+ *
1816
+ * @return the parent URI if successful, null otherwise.
1817
+ */
1818
+ public function getCommonParent(uri:URI, caseSensitive:Boolean = true) : URI
1819
+ {
1820
+ var thisURI:URI = URI.resolve(this);
1821
+ var thatURI:URI = URI.resolve(uri);
1822
+
1823
+ if(!thisURI.isAbsolute() || !thatURI.isAbsolute() ||
1824
+ thisURI.isHierarchical() == false ||
1825
+ thatURI.isHierarchical() == false)
1826
+ {
1827
+ // Both URI's must be absolute hierarchical for this to
1828
+ // make sense.
1829
+ return null;
1830
+ }
1831
+
1832
+ var relation:int = thisURI.getRelation(thatURI);
1833
+ if (relation == URI.NOT_RELATED)
1834
+ {
1835
+ // The given URI is not related to this one. No
1836
+ // common parent.
1837
+ return null;
1838
+ }
1839
+
1840
+ thisURI.chdir(".");
1841
+ thatURI.chdir(".");
1842
+
1843
+ var strBefore:String, strAfter:String;
1844
+ do
1845
+ {
1846
+ relation = thisURI.getRelation(thatURI, caseSensitive);
1847
+ if(relation == URI.EQUAL || relation == URI.PARENT)
1848
+ break;
1849
+
1850
+ // If strBefore and strAfter end up being the same,
1851
+ // we know we are at the root of the path because
1852
+ // chdir("..") is doing nothing.
1853
+ strBefore = thisURI.toString();
1854
+ thisURI.chdir("..");
1855
+ strAfter = thisURI.toString();
1856
+ }
1857
+ while(strBefore != strAfter);
1858
+
1859
+ return thisURI;
1860
+ }
1861
+
1862
+
1863
+ /**
1864
+ * This function is used to move around in a URI in a way similar
1865
+ * to the 'cd' or 'chdir' commands on Unix. These operations are
1866
+ * completely string based, using the context of the URI to
1867
+ * determine the position within the path. The heuristics used
1868
+ * to determine the action are based off Appendix C in RFC 2396.
1869
+ *
1870
+ * <p>URI paths that end in '/' are considered paths that point to
1871
+ * directories, while paths that do not end in '/' are files. For
1872
+ * example, if you execute chdir("d") on the following URI's:<br/>
1873
+ * 1. http://something.com/a/b/c/ (directory)<br/>
1874
+ * 2. http://something.com/a/b/c (not directory)<br/>
1875
+ * you will get:<br/>
1876
+ * 1. http://something.com/a/b/c/d<br/>
1877
+ * 2. http://something.com/a/b/d<br/></p>
1878
+ *
1879
+ * <p>See RFC 2396, Appendix C for more info.</p>
1880
+ *
1881
+ * @param reference the URI or path to "cd" to.
1882
+ * @param escape true if the passed reference string should be URI
1883
+ * escaped before using it.
1884
+ *
1885
+ * @return true if the chdir was successful, false otherwise.
1886
+ */
1887
+ public function chdir(reference:String, escape:Boolean = false) : Boolean
1888
+ {
1889
+ var uriReference:URI;
1890
+ var ref:String = reference;
1891
+
1892
+ if (escape)
1893
+ ref = URI.escapeChars(reference);
1894
+
1895
+ if (ref == "")
1896
+ {
1897
+ // NOOP
1898
+ return true;
1899
+ }
1900
+ else if (ref.substr(0, 2) == "//")
1901
+ {
1902
+ // Special case. This is an absolute URI but without the scheme.
1903
+ // Take the scheme from this URI and tack it on. This is
1904
+ // intended to make working with chdir() a little more
1905
+ // tolerant.
1906
+ var final:String = this.scheme + ":" + ref;
1907
+
1908
+ return constructURI(final);
1909
+ }
1910
+ else if (ref.charAt(0) == "?")
1911
+ {
1912
+ // A relative URI that is just a query part is essentially
1913
+ // a "./?query". We tack on the "./" here to make the rest
1914
+ // of our logic work.
1915
+ ref = "./" + ref;
1916
+ }
1917
+
1918
+ // Parse the reference passed in as a URI. This way we
1919
+ // get any query and fragments parsed out as well.
1920
+ uriReference = new URI(ref);
1921
+
1922
+ if (uriReference.isAbsolute() ||
1923
+ uriReference.isHierarchical() == false)
1924
+ {
1925
+ // If the URI given is a full URI, it replaces this one.
1926
+ copyURI(uriReference);
1927
+ return true;
1928
+ }
1929
+
1930
+
1931
+ var thisPath:String, thatPath:String;
1932
+ var thisParts:Array, thatParts:Array;
1933
+ var thisIsDir:Boolean = false, thatIsDir:Boolean = false;
1934
+ var thisIsAbs:Boolean = false, thatIsAbs:Boolean = false;
1935
+ var lastIsDotOperation:Boolean = false;
1936
+ var curDir:String;
1937
+ var i:int;
1938
+
1939
+ thisPath = this.path;
1940
+ thatPath = uriReference.path;
1941
+
1942
+ if (thisPath.length > 0)
1943
+ thisParts = thisPath.split("/");
1944
+ else
1945
+ thisParts = new Array();
1946
+
1947
+ if (thatPath.length > 0)
1948
+ thatParts = thatPath.split("/");
1949
+ else
1950
+ thatParts = new Array();
1951
+
1952
+ if (thisParts.length > 0 && thisParts[0] == "")
1953
+ {
1954
+ thisIsAbs = true;
1955
+ thisParts.shift(); // pop the first one off the array
1956
+ }
1957
+ if (thisParts.length > 0 && thisParts[thisParts.length - 1] == "")
1958
+ {
1959
+ thisIsDir = true;
1960
+ thisParts.pop(); // pop the last one off the array
1961
+ }
1962
+
1963
+ if (thatParts.length > 0 && thatParts[0] == "")
1964
+ {
1965
+ thatIsAbs = true;
1966
+ thatParts.shift(); // pop the first one off the array
1967
+ }
1968
+ if (thatParts.length > 0 && thatParts[thatParts.length - 1] == "")
1969
+ {
1970
+ thatIsDir = true;
1971
+ thatParts.pop(); // pop the last one off the array
1972
+ }
1973
+
1974
+ if (thatIsAbs)
1975
+ {
1976
+ // The reference is an absolute path (starts with a slash).
1977
+ // It replaces this path wholesale.
1978
+ this.path = uriReference.path;
1979
+
1980
+ // And it inherits the query and fragment
1981
+ this.queryRaw = uriReference.queryRaw;
1982
+ this.fragment = uriReference.fragment;
1983
+
1984
+ return true;
1985
+ }
1986
+ else if (thatParts.length == 0 && uriReference.query == "")
1987
+ {
1988
+ // The reference must have only been a fragment. Fragments just
1989
+ // get appended to whatever the current path is. We don't want
1990
+ // to overwrite any query that may already exist, so this case
1991
+ // only takes on the new fragment.
1992
+ this.fragment = uriReference.fragment;
1993
+ return true;
1994
+ }
1995
+ else if (thisIsDir == false && thisParts.length > 0)
1996
+ {
1997
+ // This path ends in a file. It goes away no matter what.
1998
+ thisParts.pop();
1999
+ }
2000
+
2001
+ // By default, this assumes the query and fragment of the reference
2002
+ this.queryRaw = uriReference.queryRaw;
2003
+ this.fragment = uriReference.fragment;
2004
+
2005
+ // Append the parts of the path from the passed in reference
2006
+ // to this object's path.
2007
+ thisParts = thisParts.concat(thatParts);
2008
+
2009
+ for(i = 0; i < thisParts.length; i++)
2010
+ {
2011
+ curDir = thisParts[i];
2012
+ lastIsDotOperation = false;
2013
+
2014
+ if (curDir == ".")
2015
+ {
2016
+ thisParts.splice(i, 1);
2017
+ i = i - 1; // account for removing this item
2018
+ lastIsDotOperation = true;
2019
+ }
2020
+ else if (curDir == "..")
2021
+ {
2022
+ if (i >= 1)
2023
+ {
2024
+ if (thisParts[i - 1] == "..")
2025
+ {
2026
+ // If the previous is a "..", we must have skipped
2027
+ // it due to this URI being relative. We can't
2028
+ // collapse leading ".."s in a relative URI, so
2029
+ // do nothing.
2030
+ }
2031
+ else
2032
+ {
2033
+ thisParts.splice(i - 1, 2);
2034
+ i = i - 2; // move back to account for the 2 we removed
2035
+ }
2036
+ }
2037
+ else
2038
+ {
2039
+ // This is the first thing in the path.
2040
+
2041
+ if (isRelative())
2042
+ {
2043
+ // We can't collapse leading ".."s in a relative
2044
+ // path. Do noting.
2045
+ }
2046
+ else
2047
+ {
2048
+ // This is an abnormal case. We have dot-dotted up
2049
+ // past the base of our "file system". This is a
2050
+ // case where we had a /path/like/this.htm and were
2051
+ // given a path to chdir to like this:
2052
+ // ../../../../../../mydir
2053
+ // Obviously, it has too many ".." and will take us
2054
+ // up beyond the top of the URI. However, according
2055
+ // RFC 2396 Appendix C.2, we should try to handle
2056
+ // these abnormal cases appropriately. In this case,
2057
+ // we will do what UNIX command lines do if you are
2058
+ // at the root (/) of the filesystem and execute:
2059
+ // # cd ../../../../../bin
2060
+ // Which will put you in /bin. Essentially, the extra
2061
+ // ".."'s will just get eaten.
2062
+
2063
+ thisParts.splice(i, 1);
2064
+ i = i - 1; // account for the ".." we just removed
2065
+ }
2066
+ }
2067
+
2068
+ lastIsDotOperation = true;
2069
+ }
2070
+ }
2071
+
2072
+ var finalPath:String = "";
2073
+
2074
+ // If the last thing in the path was a "." or "..", then this thing is a
2075
+ // directory. If the last thing isn't a dot-op, then we don't want to
2076
+ // blow away any information about the directory (hence the "|=" binary
2077
+ // assignment).
2078
+ thatIsDir = thatIsDir || lastIsDotOperation;
2079
+
2080
+ // Reconstruct the path with the abs/dir info we have
2081
+ finalPath = joinPath(thisParts, thisIsAbs, thatIsDir);
2082
+
2083
+ // Set the path (automatically escaping it)
2084
+ this.path = finalPath;
2085
+
2086
+ return true;
2087
+ }
2088
+
2089
+ /**
2090
+ * @private
2091
+ * Join an array of path parts back into a URI style path string.
2092
+ * This is used by the various path logic functions to recombine
2093
+ * a path. This is different than the standard Array.join()
2094
+ * function because we need to take into account the starting and
2095
+ * ending path delimiters if this is an absolute path or a
2096
+ * directory.
2097
+ *
2098
+ * @param parts the Array that contains strings of each path part.
2099
+ * @param isAbs true if the given path is absolute
2100
+ * @param isDir true if the given path is a directory
2101
+ *
2102
+ * @return the combined path string.
2103
+ */
2104
+ protected function joinPath(parts:Array, isAbs:Boolean, isDir:Boolean) : String
2105
+ {
2106
+ var pathStr:String = "";
2107
+ var i:int;
2108
+
2109
+ for (i = 0; i < parts.length; i++)
2110
+ {
2111
+ if (pathStr.length > 0)
2112
+ pathStr += "/";
2113
+
2114
+ pathStr += parts[i];
2115
+ }
2116
+
2117
+ // If this path is a directory, tack on the directory delimiter,
2118
+ // but only if the path contains something. Adding this to an
2119
+ // empty path would make it "/", which is an absolute path that
2120
+ // starts at the root.
2121
+ if (isDir && pathStr.length > 0)
2122
+ pathStr += "/";
2123
+
2124
+ if (isAbs)
2125
+ pathStr = "/" + pathStr;
2126
+
2127
+ return pathStr;
2128
+ }
2129
+
2130
+ /**
2131
+ * Given an absolute URI, make this relative URI absolute using
2132
+ * the given URI as a base. This URI instance must be relative
2133
+ * and the base_uri must be absolute.
2134
+ *
2135
+ * @param base_uri URI to use as the base from which to make
2136
+ * this relative URI into an absolute URI.
2137
+ *
2138
+ * @return true if successful, false otherwise.
2139
+ */
2140
+ public function makeAbsoluteURI(base_uri:URI) : Boolean
2141
+ {
2142
+ if (isAbsolute() || base_uri.isRelative())
2143
+ {
2144
+ // This URI needs to be relative, and the base needs to be
2145
+ // absolute otherwise we won't know what to do!
2146
+ return false;
2147
+ }
2148
+
2149
+ // Make a copy of the base URI. We don't want to modify
2150
+ // the passed URI.
2151
+ var base:URI = new URI();
2152
+ base.copyURI(base_uri);
2153
+
2154
+ // ChDir on the base URI. This will preserve any query
2155
+ // and fragment we have.
2156
+ if (base.chdir(toString()) == false)
2157
+ return false;
2158
+
2159
+ // It worked, so copy the base into this one
2160
+ copyURI(base);
2161
+
2162
+ return true;
2163
+ }
2164
+
2165
+
2166
+ /**
2167
+ * Given a URI to use as a base from which this object should be
2168
+ * relative to, convert this object into a relative URI. For example,
2169
+ * if you have:
2170
+ *
2171
+ * <listing>
2172
+ * var uri1:URI = new URI("http://something.com/path/to/some/file.html");
2173
+ * var uri2:URI = new URI("http://something.com/path/to/another/file.html");
2174
+ *
2175
+ * uri1.MakeRelativePath(uri2);</listing>
2176
+ *
2177
+ * <p>uri1 will have a final value of "../some/file.html"</p>
2178
+ *
2179
+ * <p>Note! This function is brute force. If you have two URI's
2180
+ * that are completely unrelated, this will still attempt to make
2181
+ * the relative URI. In that case, you will most likely get a
2182
+ * relative path that looks something like:</p>
2183
+ *
2184
+ * <p>../../../../../../some/path/to/my/file.html</p>
2185
+ *
2186
+ * @param base_uri the URI from which to make this URI relative
2187
+ *
2188
+ * @return true if successful, false if the base_uri and this URI
2189
+ * are not related, of if error.
2190
+ */
2191
+ public function makeRelativeURI(base_uri:URI, caseSensitive:Boolean = true) : Boolean
2192
+ {
2193
+ var base:URI = new URI();
2194
+ base.copyURI(base_uri);
2195
+
2196
+ var thisParts:Array, thatParts:Array;
2197
+ var finalParts:Array = new Array();
2198
+ var thisPart:String, thatPart:String, finalPath:String;
2199
+ var pathStr:String = this.path;
2200
+ var queryStr:String = this.queryRaw;
2201
+ var fragmentStr:String = this.fragment;
2202
+ var i:int;
2203
+ var diff:Boolean = false;
2204
+ var isDir:Boolean = false;
2205
+
2206
+ if (isRelative())
2207
+ {
2208
+ // We're already relative.
2209
+ return true;
2210
+ }
2211
+
2212
+ if (base.isRelative())
2213
+ {
2214
+ // The base is relative. A relative base doesn't make sense.
2215
+ return false;
2216
+ }
2217
+
2218
+
2219
+ if ( (isOfType(base_uri.scheme) == false) ||
2220
+ (this.authority != base_uri.authority) )
2221
+ {
2222
+ // The schemes and/or authorities are different. We can't
2223
+ // make a relative path to something that is completely
2224
+ // unrelated.
2225
+ return false;
2226
+ }
2227
+
2228
+ // Record the state of this URI
2229
+ isDir = isDirectory();
2230
+
2231
+ // We are based of the directory of the given URI. We need to
2232
+ // make sure the URI is pointing to a directory. Changing
2233
+ // directory to "." will remove any file name if the base is
2234
+ // not a directory.
2235
+ base.chdir(".");
2236
+
2237
+ thisParts = pathStr.split("/");
2238
+ thatParts = base.path.split("/");
2239
+
2240
+ if (thisParts.length > 0 && thisParts[0] == "")
2241
+ thisParts.shift();
2242
+
2243
+ if (thisParts.length > 0 && thisParts[thisParts.length - 1] == "")
2244
+ {
2245
+ isDir = true;
2246
+ thisParts.pop();
2247
+ }
2248
+
2249
+ if (thatParts.length > 0 && thatParts[0] == "")
2250
+ thatParts.shift();
2251
+ if (thatParts.length > 0 && thatParts[thatParts.length - 1] == "")
2252
+ thatParts.pop();
2253
+
2254
+
2255
+ // Now that we have the paths split into an array of directories,
2256
+ // we can compare the two paths. We start from the left of side
2257
+ // of the path and start comparing. When we either run out of
2258
+ // directories (one path is longer than the other), or we find
2259
+ // a directory that is different, we stop. The remaining parts
2260
+ // of each path is then used to determine the relative path. For
2261
+ // example, lets say we have:
2262
+ // path we want to make relative: /a/b/c/d/e.txt
2263
+ // path to use as base for relative: /a/b/f/
2264
+ //
2265
+ // This loop will start at the left, and remove directories
2266
+ // until we get a mismatch or run off the end of one of them.
2267
+ // In this example, the result will be:
2268
+ // c/d/e.txt
2269
+ // f
2270
+ //
2271
+ // For every part left over in the base path, we prepend a ".."
2272
+ // to the relative to get the final path:
2273
+ // ../c/d/e.txt
2274
+ while(thatParts.length > 0)
2275
+ {
2276
+ if (thisParts.length == 0)
2277
+ {
2278
+ // we matched all there is to match, we are done.
2279
+ // This is the case where "this" object is a parent
2280
+ // path of the given URI. eg:
2281
+ // this.path = /a/b/ (thisParts)
2282
+ // base.path = /a/b/c/d/e/ (thatParts)
2283
+ break;
2284
+ }
2285
+
2286
+ thisPart = thisParts[0];
2287
+ thatPart = thatParts[0];
2288
+
2289
+ if (compareStr(thisPart, thatPart, caseSensitive))
2290
+ {
2291
+ thisParts.shift();
2292
+ thatParts.shift();
2293
+ }
2294
+ else
2295
+ break;
2296
+ }
2297
+
2298
+ // If there are any path info left from the base URI, that means
2299
+ // **this** object is above the given URI in the file tree. For
2300
+ // each part left over in the given URI, we need to move up one
2301
+ // directory to get where we are.
2302
+ var dotdot:String = "..";
2303
+ for (i = 0; i < thatParts.length; i++)
2304
+ {
2305
+ finalParts.push(dotdot);
2306
+ }
2307
+
2308
+ // Append the parts of this URI to any dot-dot's we have
2309
+ finalParts = finalParts.concat(thisParts);
2310
+
2311
+ // Join the parts back into a path
2312
+ finalPath = joinPath(finalParts, false /* not absolute */, isDir);
2313
+
2314
+ if (finalPath.length == 0)
2315
+ {
2316
+ // The two URI's are exactly the same. The proper relative
2317
+ // path is:
2318
+ finalPath = "./";
2319
+ }
2320
+
2321
+ // Set the parts of the URI, preserving the original query and
2322
+ // fragment parts.
2323
+ setParts("", "", "", finalPath, queryStr, fragmentStr);
2324
+
2325
+ return true;
2326
+ }
2327
+
2328
+ /**
2329
+ * Given a string, convert it to a URI. The string could be a
2330
+ * full URI that is improperly escaped, a malformed URI (e.g.
2331
+ * missing a protocol like "www.something.com"), a relative URI,
2332
+ * or any variation there of.
2333
+ *
2334
+ * <p>The intention of this function is to take anything that a
2335
+ * user might manually enter as a URI/URL and try to determine what
2336
+ * they mean. This function differs from the URI constructor in
2337
+ * that it makes some assumptions to make it easy to import user
2338
+ * entered URI data.</p>
2339
+ *
2340
+ * <p>This function is intended to be a helper function.
2341
+ * It is not all-knowning and will probably make mistakes
2342
+ * when attempting to parse a string of unknown origin. If
2343
+ * your applicaiton is receiving input from the user, your
2344
+ * application should already have a good idea what the user
2345
+ * should be entering, and your application should be
2346
+ * pre-processing the user's input to make sure it is well formed
2347
+ * before passing it to this function.</p>
2348
+ *
2349
+ * <p>It is assumed that the string given to this function is
2350
+ * something the user may have manually entered. Given this,
2351
+ * the URI string is probably unescaped or improperly escaped.
2352
+ * This function will attempt to properly escape the URI by
2353
+ * using forceEscape(). The result is that a toString() call
2354
+ * on a URI that was created from unknownToURI() may not match
2355
+ * the input string due to the difference in escaping.</p>
2356
+ *
2357
+ * @param unknown a potental URI string that should be parsed
2358
+ * and loaded into this object.
2359
+ * @param defaultScheme if it is determined that the passed string
2360
+ * looks like a URI, but it is missing the scheme part, this
2361
+ * string will be used as the missing scheme.
2362
+ *
2363
+ * @return true if the given string was successfully parsed into
2364
+ * a valid URI object, false otherwise.
2365
+ */
2366
+ public function unknownToURI(unknown:String, defaultScheme:String = "http") : Boolean
2367
+ {
2368
+ var temp:String;
2369
+
2370
+ if (unknown.length == 0)
2371
+ {
2372
+ this.initialize();
2373
+ return false;
2374
+ }
2375
+
2376
+ // Some users love the backslash key. Fix it.
2377
+ unknown = unknown.replace(/\\/g, "/");
2378
+
2379
+ // Check for any obviously missing scheme.
2380
+ if (unknown.length >= 2)
2381
+ {
2382
+ temp = unknown.substr(0, 2);
2383
+ if (temp == "//")
2384
+ unknown = defaultScheme + ":" + unknown;
2385
+ }
2386
+
2387
+ if (unknown.length >= 3)
2388
+ {
2389
+ temp = unknown.substr(0, 3);
2390
+ if (temp == "://")
2391
+ unknown = defaultScheme + unknown;
2392
+ }
2393
+
2394
+ // Try parsing it as a normal URI
2395
+ var uri:URI = new URI(unknown);
2396
+
2397
+ if (uri.isHierarchical() == false)
2398
+ {
2399
+ if (uri.scheme == UNKNOWN_SCHEME)
2400
+ {
2401
+ this.initialize();
2402
+ return false;
2403
+ }
2404
+
2405
+ // It's a non-hierarchical URI
2406
+ copyURI(uri);
2407
+ forceEscape();
2408
+ return true;
2409
+ }
2410
+ else if ((uri.scheme != UNKNOWN_SCHEME) &&
2411
+ (uri.scheme.length > 0))
2412
+ {
2413
+ if ( (uri.authority.length > 0) ||
2414
+ (uri.scheme == "file") )
2415
+ {
2416
+ // file://... URI
2417
+ copyURI(uri);
2418
+ forceEscape(); // ensure proper escaping
2419
+ return true;
2420
+ }
2421
+ else if (uri.authority.length == 0 && uri.path.length == 0)
2422
+ {
2423
+ // It's is an incomplete URI (eg "http://")
2424
+
2425
+ setParts(uri.scheme, "", "", "", "", "");
2426
+ return false;
2427
+ }
2428
+ }
2429
+ else
2430
+ {
2431
+ // Possible relative URI. We can only detect relative URI's
2432
+ // that start with "." or "..". If it starts with something
2433
+ // else, the parsing is ambiguous.
2434
+ var path:String = uri.path;
2435
+
2436
+ if (path == ".." || path == "." ||
2437
+ (path.length >= 3 && path.substr(0, 3) == "../") ||
2438
+ (path.length >= 2 && path.substr(0, 2) == "./") )
2439
+ {
2440
+ // This is a relative URI.
2441
+ copyURI(uri);
2442
+ forceEscape();
2443
+ return true;
2444
+ }
2445
+ }
2446
+
2447
+ // Ok, it looks like we are just a normal URI missing the scheme. Tack
2448
+ // on the scheme.
2449
+ uri = new URI(defaultScheme + "://" + unknown);
2450
+
2451
+ // Check to see if we are good now
2452
+ if (uri.scheme.length > 0 && uri.authority.length > 0)
2453
+ {
2454
+ // It was just missing the scheme.
2455
+ copyURI(uri);
2456
+ forceEscape(); // Make sure we are properly encoded.
2457
+ return true;
2458
+ }
2459
+
2460
+ // don't know what this is
2461
+ this.initialize();
2462
+ return false;
2463
+ }
2464
+
2465
+ } // end URI class
2466
+ } // end package
skin/frontend/base/default/uploadfile/com/adobe/net/URIEncodingBitmap.as ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.net
34
+ {
35
+ import flash.utils.ByteArray;
36
+
37
+ /**
38
+ * This class implements an efficient lookup table for URI
39
+ * character escaping. This class is only needed if you
40
+ * create a derived class of URI to handle custom URI
41
+ * syntax. This class is used internally by URI.
42
+ *
43
+ * @langversion ActionScript 3.0
44
+ * @playerversion Flash 9.0*
45
+ */
46
+ public class URIEncodingBitmap extends ByteArray
47
+ {
48
+ /**
49
+ * Constructor. Creates an encoding bitmap using the given
50
+ * string of characters as the set of characters that need
51
+ * to be URI escaped.
52
+ *
53
+ * @langversion ActionScript 3.0
54
+ * @playerversion Flash 9.0
55
+ */
56
+ public function URIEncodingBitmap(charsToEscape:String) : void
57
+ {
58
+ var i:int;
59
+ var data:ByteArray = new ByteArray();
60
+
61
+ // Initialize our 128 bits (16 bytes) to zero
62
+ for (i = 0; i < 16; i++)
63
+ this.writeByte(0);
64
+
65
+ data.writeUTFBytes(charsToEscape);
66
+ data.position = 0;
67
+
68
+ while (data.bytesAvailable)
69
+ {
70
+ var c:int = data.readByte();
71
+
72
+ if (c > 0x7f)
73
+ continue; // only escape low bytes
74
+
75
+ var enc:int;
76
+ this.position = (c >> 3);
77
+ enc = this.readByte();
78
+ enc |= 1 << (c & 0x7);
79
+ this.position = (c >> 3);
80
+ this.writeByte(enc);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Based on the data table contained in this object, check
86
+ * if the given character should be escaped.
87
+ *
88
+ * @param char the character to be escaped. Only the first
89
+ * character in the string is used. Any other characters
90
+ * are ignored.
91
+ *
92
+ * @return the integer value of the raw UTF8 character. For
93
+ * example, if '%' is given, the return value is 37 (0x25).
94
+ * If the character given does not need to be escaped, the
95
+ * return value is zero.
96
+ *
97
+ * @langversion ActionScript 3.0
98
+ * @playerversion Flash 9.0
99
+ */
100
+ public function ShouldEscape(char:String) : int
101
+ {
102
+ var data:ByteArray = new ByteArray();
103
+ var c:int, mask:int;
104
+
105
+ // write the character into a ByteArray so
106
+ // we can pull it out as a raw byte value.
107
+ data.writeUTFBytes(char);
108
+ data.position = 0;
109
+ c = data.readByte();
110
+
111
+ if (c & 0x80)
112
+ {
113
+ // don't escape high byte characters. It can make international
114
+ // URI's unreadable. We just want to escape characters that would
115
+ // make URI syntax ambiguous.
116
+ return 0;
117
+ }
118
+ else if ((c < 0x1f) || (c == 0x7f))
119
+ {
120
+ // control characters must be escaped.
121
+ return c;
122
+ }
123
+
124
+ this.position = (c >> 3);
125
+ mask = this.readByte();
126
+
127
+ if (mask & (1 << (c & 0x7)))
128
+ {
129
+ // we need to escape this, return the numeric value
130
+ // of the character
131
+ return c;
132
+ }
133
+ else
134
+ {
135
+ return 0;
136
+ }
137
+ }
138
+ }
139
+ }
skin/frontend/base/default/uploadfile/com/adobe/net/proxies/RFC2817Socket.as ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.net.proxies
33
+ {
34
+ import flash.events.Event;
35
+ import flash.events.IOErrorEvent;
36
+ import flash.events.ProgressEvent;
37
+ import flash.net.Socket;
38
+
39
+ /**
40
+ * This class allows TCP socket connections through HTTP proxies in accordance with
41
+ * RFC 2817:
42
+ *
43
+ * ftp://ftp.rfc-editor.org/in-notes/rfc2817.txt
44
+ *
45
+ * It can also be used to make direct connections to a destination, as well. If you
46
+ * pass the host and port into the constructor, no proxy will be used. You can also
47
+ * call connect, passing in the host and the port, and if you didn't set the proxy
48
+ * info, a direct connection will be made. A proxy is only used after you have called
49
+ * the setProxyInfo function.
50
+ *
51
+ * The connection to and negotiation with the proxy is completely hidden. All the
52
+ * same events are thrown whether you are using a proxy or not, and the data you
53
+ * receive from the target server will look exact as it would if you were connected
54
+ * to it directly rather than through a proxy.
55
+ *
56
+ * @author Christian Cantrell
57
+ *
58
+ **/
59
+ public class RFC2817Socket
60
+ extends Socket
61
+ {
62
+ private var proxyHost:String = null;
63
+ private var host:String = null;
64
+ private var proxyPort:int = 0;
65
+ private var port:int = 0;
66
+ private var deferredEventHandlers:Object = new Object();
67
+ private var buffer:String = new String();
68
+
69
+ /**
70
+ * Construct a new RFC2817Socket object. If you pass in the host and the port,
71
+ * no proxy will be used. If you want to use a proxy, instantiate with no
72
+ * arguments, call setProxyInfo, then call connect.
73
+ **/
74
+ public function RFC2817Socket(host:String = null, port:int = 0)
75
+ {
76
+ super(host, port);
77
+ }
78
+
79
+ /**
80
+ * Set the proxy host and port number. Your connection will only proxied if
81
+ * this function has been called.
82
+ **/
83
+ public function setProxyInfo(host:String, port:int):void
84
+ {
85
+ this.proxyHost = host;
86
+ this.proxyPort = port;
87
+
88
+ var deferredSocketDataHandler:Object = this.deferredEventHandlers[ProgressEvent.SOCKET_DATA];
89
+ var deferredConnectHandler:Object = this.deferredEventHandlers[Event.CONNECT];
90
+
91
+ if (deferredSocketDataHandler != null)
92
+ {
93
+ super.removeEventListener(ProgressEvent.SOCKET_DATA, deferredSocketDataHandler.listener, deferredSocketDataHandler.useCapture);
94
+ }
95
+
96
+ if (deferredConnectHandler != null)
97
+ {
98
+ super.removeEventListener(Event.CONNECT, deferredConnectHandler.listener, deferredConnectHandler.useCapture);
99
+ }
100
+ }
101
+
102
+ /**
103
+ * Connect to the specified host over the specified port. If you want your
104
+ * connection proxied, call the setProxyInfo function first.
105
+ **/
106
+ public override function connect(host:String, port:int):void
107
+ {
108
+ if (this.proxyHost == null)
109
+ {
110
+ this.redirectConnectEvent();
111
+ this.redirectSocketDataEvent();
112
+ super.connect(host, port);
113
+ }
114
+ else
115
+ {
116
+ this.host = host;
117
+ this.port = port;
118
+ super.addEventListener(Event.CONNECT, this.onConnect);
119
+ super.addEventListener(ProgressEvent.SOCKET_DATA, this.onSocketData);
120
+ super.connect(this.proxyHost, this.proxyPort);
121
+ }
122
+ }
123
+
124
+ private function onConnect(event:Event):void
125
+ {
126
+ this.writeUTFBytes("CONNECT "+this.host+":"+this.port+" HTTP/1.1\n\n");
127
+ this.flush();
128
+ this.redirectConnectEvent();
129
+ }
130
+
131
+ private function onSocketData(event:ProgressEvent):void
132
+ {
133
+ while (this.bytesAvailable != 0)
134
+ {
135
+ this.buffer += this.readUTFBytes(1);
136
+ if (this.buffer.search(/\r?\n\r?\n$/) != -1)
137
+ {
138
+ this.checkResponse(event);
139
+ break;
140
+ }
141
+ }
142
+ }
143
+
144
+ private function checkResponse(event:ProgressEvent):void
145
+ {
146
+ var responseCode:String = this.buffer.substr(this.buffer.indexOf(" ")+1, 3);
147
+
148
+ if (responseCode.search(/^2/) == -1)
149
+ {
150
+ var ioError:IOErrorEvent = new IOErrorEvent(IOErrorEvent.IO_ERROR);
151
+ ioError.text = "Error connecting to the proxy ["+this.proxyHost+"] on port ["+this.proxyPort+"]: " + this.buffer;
152
+ this.dispatchEvent(ioError);
153
+ }
154
+ else
155
+ {
156
+ this.redirectSocketDataEvent();
157
+ this.dispatchEvent(new Event(Event.CONNECT));
158
+ if (this.bytesAvailable > 0)
159
+ {
160
+ this.dispatchEvent(event);
161
+ }
162
+ }
163
+ this.buffer = null;
164
+ }
165
+
166
+ private function redirectConnectEvent():void
167
+ {
168
+ super.removeEventListener(Event.CONNECT, onConnect);
169
+ var deferredEventHandler:Object = this.deferredEventHandlers[Event.CONNECT];
170
+ if (deferredEventHandler != null)
171
+ {
172
+ super.addEventListener(Event.CONNECT, deferredEventHandler.listener, deferredEventHandler.useCapture, deferredEventHandler.priority, deferredEventHandler.useWeakReference);
173
+ }
174
+ }
175
+
176
+ private function redirectSocketDataEvent():void
177
+ {
178
+ super.removeEventListener(ProgressEvent.SOCKET_DATA, onSocketData);
179
+ var deferredEventHandler:Object = this.deferredEventHandlers[ProgressEvent.SOCKET_DATA];
180
+ if (deferredEventHandler != null)
181
+ {
182
+ super.addEventListener(ProgressEvent.SOCKET_DATA, deferredEventHandler.listener, deferredEventHandler.useCapture, deferredEventHandler.priority, deferredEventHandler.useWeakReference);
183
+ }
184
+ }
185
+
186
+ public override function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int=0.0, useWeakReference:Boolean=false):void
187
+ {
188
+ if (type == Event.CONNECT || type == ProgressEvent.SOCKET_DATA)
189
+ {
190
+ this.deferredEventHandlers[type] = {listener:listener,useCapture:useCapture, priority:priority, useWeakReference:useWeakReference};
191
+ }
192
+ else
193
+ {
194
+ super.addEventListener(type, listener, useCapture, priority, useWeakReference);
195
+ }
196
+ }
197
+ }
198
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Database.as ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict
2
+ {
3
+ public class Database
4
+ {
5
+ private var _name:String;
6
+ private var _description:String;
7
+
8
+ public function Database(name:String, description:String)
9
+ {
10
+ this._name = name;
11
+ this._description = description;
12
+ }
13
+
14
+ public function set name(name:String):void
15
+ {
16
+ this._name = name;
17
+ }
18
+
19
+ public function get name():String
20
+ {
21
+ return this._name;
22
+ }
23
+
24
+ public function set description(description:String):void
25
+ {
26
+ this._description = description;
27
+ }
28
+
29
+ public function get description():String
30
+ {
31
+ return this._description;
32
+ }
33
+ }
34
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Definition.as ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict
2
+ {
3
+ public class Definition
4
+ {
5
+ private var _definition:String;
6
+ private var _database:String;
7
+ private var _term:String;
8
+
9
+ public function set definition(definition:String):void
10
+ {
11
+ this._definition = definition;
12
+ }
13
+
14
+ public function get definition():String
15
+ {
16
+ return this._definition;
17
+ }
18
+
19
+ public function set database(database:String):void
20
+ {
21
+ this._database = database;
22
+ }
23
+
24
+ public function get database():String
25
+ {
26
+ return this._database;
27
+ }
28
+
29
+ public function set term(term:String):void
30
+ {
31
+ this._term = term;
32
+ }
33
+
34
+ public function get term():String
35
+ {
36
+ return this._term;
37
+ }
38
+ }
39
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Dict.as ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict
2
+ {
3
+ import com.adobe.protocols.dict.events.*;
4
+ import com.adobe.protocols.dict.util.*;
5
+
6
+ import flash.events.Event;
7
+ import flash.events.EventDispatcher;
8
+ import flash.events.IOErrorEvent;
9
+ import flash.events.ProgressEvent;
10
+ import flash.events.SecurityErrorEvent;
11
+ import flash.net.Socket;
12
+ import mx.rpc.http.HTTPService;
13
+ import mx.rpc.events.ResultEvent;
14
+ import mx.rpc.events.FaultEvent;
15
+ import flash.xml.XMLNode;
16
+ import mx.utils.StringUtil;
17
+
18
+ public class Dict
19
+ extends EventDispatcher
20
+ {
21
+ // Event type names.
22
+ public static var CONNECTED:String = "connected";
23
+ public static var DISCONNECTED:String = "disconnected";
24
+ public static var IO_ERROR:String = IOErrorEvent.IO_ERROR;
25
+ public static var ERROR:String = "error";
26
+ public static var SERVERS:String = "servers";
27
+ public static var DATABASES:String = "databases";
28
+ public static var MATCH_STRATEGIES:String = "matchStrategies";
29
+ public static var DEFINITION:String = "definition";
30
+ public static var DEFINITION_HEADER:String = "definitionHeader";
31
+ public static var MATCH:String = "match";
32
+ public static var NO_MATCH:String = "noMatch";
33
+
34
+ public static var FIRST_MATCH:uint = 0;
35
+ public static var ALL_DATABASES:uint = 1;
36
+
37
+ private var socket:SocketHelper;
38
+
39
+ private var dbShortList:Boolean;
40
+
41
+ public function Dict()
42
+ {
43
+ this.socket = new SocketHelper();
44
+ this.socket.addEventListener(Event.CONNECT, connected);
45
+ this.socket.addEventListener(Event.CLOSE, disconnected);
46
+ this.socket.addEventListener(SocketHelper.COMPLETE_RESPONSE, incomingData);
47
+ this.socket.addEventListener(IOErrorEvent.IO_ERROR, ioError);
48
+ this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
49
+ }
50
+
51
+ public function connect(server:String, port:uint = 2628):void
52
+ {
53
+ if (this.socket.connected)
54
+ {
55
+ this.socket.close();
56
+ }
57
+ this.socket.connect(server, port);
58
+ }
59
+
60
+ public function connectThroughProxy(proxyServer:String,
61
+ proxyPort:int,
62
+ server:String,
63
+ port:uint = 2628):void
64
+ {
65
+ if (this.socket.connected)
66
+ {
67
+ this.socket.close();
68
+ }
69
+ this.socket.setProxyInfo(proxyServer, proxyPort);
70
+ this.socket.connect(server, port);
71
+ }
72
+
73
+ public function disconnect():void
74
+ {
75
+ this.socket.close();
76
+ this.disconnected(null);
77
+ }
78
+
79
+ public function getServers():void
80
+ {
81
+ var http:HTTPService = new HTTPService();
82
+ http.url = "http://luetzschena-stahmeln.de/dictd/xmllist.php";
83
+ http.addEventListener(ResultEvent.RESULT, incomingServerXML);
84
+ http.addEventListener(FaultEvent.FAULT, httpError);
85
+ http.resultFormat = HTTPService.RESULT_FORMAT_E4X;
86
+ http.send();
87
+ }
88
+
89
+ public function getDatabases(shortList:Boolean=true):void
90
+ {
91
+ this.dbShortList = shortList;
92
+ this.socket.writeUTFBytes("show db\r\n");
93
+ this.socket.flush();
94
+ }
95
+
96
+ public function getMatchStrategies():void
97
+ {
98
+ this.socket.writeUTFBytes("show strat\r\n");
99
+ this.socket.flush();
100
+ }
101
+
102
+ public function match(database:String, term:String, scope:String="prefix"):void
103
+ {
104
+ this.socket.writeUTFBytes("match " + database + " " + scope + " \"" + term + "\"\r\n");
105
+ this.socket.flush();
106
+ }
107
+
108
+ public function define(database:String, term:String):void
109
+ {
110
+ this.socket.writeUTFBytes("define " + database + " \"" + term + "\"\r\n");
111
+ this.socket.flush();
112
+ }
113
+
114
+ public function lookup(term:String, scope:uint):void
115
+ {
116
+ var flag:String;
117
+ if (scope == Dict.ALL_DATABASES)
118
+ {
119
+ flag = "*";
120
+ }
121
+ else if (scope == Dict.FIRST_MATCH)
122
+ {
123
+ flag = "!";
124
+ }
125
+ this.socket.writeUTFBytes("define " + flag + " \"" + term + "\"\r\n");
126
+ this.socket.flush();
127
+ }
128
+
129
+ //// Private functions ////
130
+
131
+ private function connected(event:Event):void
132
+ {
133
+ // Wait to dispatch an event until we get the 220 response.
134
+ }
135
+
136
+ private function disconnected(event:Event):void
137
+ {
138
+ dispatchEvent(new DisconnectedEvent());
139
+ }
140
+
141
+ private function incomingServerXML(event:ResultEvent):void
142
+ {
143
+ var dictd:Namespace = new Namespace("http://www.luetzschena-stahmeln.de/dictd/");
144
+ var result:XML = event.result as XML;
145
+ var server:String, description:String;
146
+ var servers:Array = new Array();
147
+ for each (var serverNode:XML in result.dictd::server)
148
+ {
149
+ server = serverNode.dictd::dictdurl;
150
+ description = serverNode.dictd::description;
151
+ if (StringUtil.trim(server).length != 0 &&
152
+ StringUtil.trim(description).length != 0)
153
+ {
154
+ var dServer:DictionaryServer = new DictionaryServer();
155
+ dServer.server = server.replace("dict://", "");
156
+ dServer.description = description;
157
+ servers.push(dServer);
158
+ }
159
+ }
160
+ var dEvent:DictionaryServerEvent = new DictionaryServerEvent();
161
+ dEvent.servers = servers;
162
+ dispatchEvent(dEvent);
163
+ }
164
+
165
+ private function incomingData(event:CompleteResponseEvent):void
166
+ {
167
+ var rawResponse:String = event.response;
168
+ var response:Response = this.parseRawResponse(rawResponse);
169
+ var responseCode:uint = response.code;
170
+ if (responseCode == 552) // no matches
171
+ {
172
+ throwNoMatchEvent(response);
173
+ }
174
+ else if (responseCode >= 400 && responseCode <= 599) // error
175
+ {
176
+ throwErrorEvent(response);
177
+ }
178
+ else if (responseCode == 220) // successful connection
179
+ {
180
+ dispatchEvent(new ConnectedEvent());
181
+ }
182
+ else if (responseCode == 110) // databases are being returned
183
+ {
184
+ throwDatabasesEvent(response);
185
+ }
186
+ else if (responseCode == 111) // matches strategies
187
+ {
188
+ throwMatchStrategiesEvent(response);
189
+ }
190
+ else if (responseCode == 152) // matches
191
+ {
192
+ throwMatchEvent(response);
193
+ }
194
+ else if (responseCode == 150)
195
+ {
196
+ throwDefinitionHeaderEvent(response);
197
+ }
198
+ else if (responseCode == 151)
199
+ {
200
+ throwDefinitionEvent(response);
201
+ }
202
+ }
203
+
204
+ private function ioError(event:IOErrorEvent):void
205
+ {
206
+ dispatchEvent(event);
207
+ }
208
+
209
+ private function httpError(event:FaultEvent):void
210
+ {
211
+ trace("httpError!");
212
+ }
213
+
214
+ private function securityError(event:SecurityErrorEvent):void
215
+ {
216
+ trace("security error!");
217
+ trace(event.text);
218
+ }
219
+
220
+ // Dispatch new events.
221
+
222
+ private function throwDatabasesEvent(response:Response):void
223
+ {
224
+ var databases:Array = new Array();
225
+ var responseArray:Array = response.body.split("\r\n");
226
+ for each (var line:String in responseArray)
227
+ {
228
+ var name:String = line.substring(0, line.indexOf(" "));
229
+ if (name == "--exit--")
230
+ {
231
+ if (this.dbShortList)
232
+ {
233
+ break;
234
+ }
235
+ continue;
236
+ }
237
+ var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
238
+ databases.push(new Database(name, description));
239
+ }
240
+ var event:DatabaseEvent = new DatabaseEvent();
241
+ event.databases = databases;
242
+ dispatchEvent(event);
243
+ }
244
+
245
+ private function throwMatchStrategiesEvent(response:Response):void
246
+ {
247
+ var strategies:Array = new Array();
248
+ var responseArray:Array = response.body.split("\r\n");
249
+ for each (var line:String in responseArray)
250
+ {
251
+ var name:String = line.substring(0, line.indexOf(" "));
252
+ var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
253
+ strategies.push(new MatchStrategy(name, description));
254
+ }
255
+ var event:MatchStrategiesEvent = new MatchStrategiesEvent();
256
+ event.strategies = strategies;
257
+ dispatchEvent(event);
258
+ }
259
+
260
+ private function throwMatchEvent(response:Response):void
261
+ {
262
+ var matches:Array = new Array();
263
+ var responseArray:Array = response.body.split("\r\n");
264
+ for each (var line:String in responseArray)
265
+ {
266
+ var match:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
267
+ matches.push(match);
268
+ }
269
+ var event:MatchEvent = new MatchEvent();
270
+ event.matches = matches;
271
+ dispatchEvent(event);
272
+ }
273
+
274
+ private function throwErrorEvent(response:Response):void
275
+ {
276
+ var event:ErrorEvent = new ErrorEvent();
277
+ event.code = response.code;
278
+ event.message = response.headerText;
279
+ dispatchEvent(event);
280
+ }
281
+
282
+ private function throwNoMatchEvent(response:Response):void
283
+ {
284
+ dispatchEvent(new NoMatchEvent());
285
+ }
286
+
287
+ private function throwDefinitionHeaderEvent(response:Response):void
288
+ {
289
+ var event:DefinitionHeaderEvent = new DefinitionHeaderEvent();
290
+ event.definitionCount = uint(response.headerText.substring(0, response.headerText.indexOf(" ")));
291
+ dispatchEvent(event);
292
+ }
293
+
294
+ private function throwDefinitionEvent(response:Response):void
295
+ {
296
+ var event:DefinitionEvent = new DefinitionEvent();
297
+ var def:Definition = new Definition();
298
+ var headerText:String = response.headerText;
299
+ var tokens:Array = headerText.match(/"[^"]+"/g);
300
+ def.term = String(tokens[0]).replace(/"/g, "");
301
+ def.database = String(tokens[1]).replace(/"/g, "");
302
+ def.definition = response.body;
303
+ event.definition = def;
304
+ dispatchEvent(event);
305
+ }
306
+
307
+ private function parseRawResponse(rawResponse:String):Response
308
+ {
309
+ var response:Response = new Response();
310
+ var fullHeader:String;
311
+ if (rawResponse.indexOf("\r\n") != -1)
312
+ {
313
+ fullHeader = rawResponse.substring(0, rawResponse.indexOf("\r\n"));
314
+ }
315
+ else
316
+ {
317
+ fullHeader = rawResponse;
318
+ }
319
+ var responseCodeMatch:Array = fullHeader.match(/^\d{3}/);
320
+ response.code = uint(responseCodeMatch[0]);
321
+ response.headerText = fullHeader.substring(fullHeader.indexOf(" ")+1, fullHeader.length);
322
+ var body:String = rawResponse.substring(rawResponse.indexOf("\r\n")+2, rawResponse.length);
323
+ body = body.replace(/\r\n\.\./, "\r\n.");
324
+ response.body = body;
325
+ return response;
326
+ }
327
+ }
328
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/DictionaryServer.as ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict
2
+ {
3
+ public class DictionaryServer
4
+ {
5
+ private var _server:String;
6
+ private var _description:String;
7
+
8
+ public function set server(server:String):void
9
+ {
10
+ this._server = server;
11
+ }
12
+
13
+ public function get server():String
14
+ {
15
+ return this._server;
16
+ }
17
+
18
+ public function set description(description:String):void
19
+ {
20
+ this._description = description;
21
+ }
22
+
23
+ public function get description():String
24
+ {
25
+ return this._description;
26
+ }
27
+ }
28
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/MatchStrategy.as ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict
2
+ {
3
+ public class MatchStrategy
4
+ {
5
+ private var _name:String;
6
+ private var _description:String;
7
+
8
+ public function MatchStrategy(name:String, description:String)
9
+ {
10
+ this._name = name;
11
+ this._description = description;
12
+ }
13
+
14
+ public function set name(name:String):void
15
+ {
16
+ this._name = name;
17
+ }
18
+
19
+ public function get name():String
20
+ {
21
+ return this._name;
22
+ }
23
+
24
+ public function set description(description:String):void
25
+ {
26
+ this._description = description;
27
+ }
28
+
29
+ public function get description():String
30
+ {
31
+ return this._description;
32
+ }
33
+ }
34
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/Response.as ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict
2
+ {
3
+ public class Response
4
+ {
5
+ private var _code:uint;
6
+ private var _headerText:String;
7
+ private var _body:String;
8
+
9
+ public function set code(code:uint):void
10
+ {
11
+ this._code = code;
12
+ }
13
+
14
+ public function set headerText(headerText:String):void
15
+ {
16
+ this._headerText = headerText;
17
+ }
18
+
19
+ public function set body(body:String):void
20
+ {
21
+ this._body = body;
22
+ }
23
+
24
+ public function get code():uint
25
+ {
26
+ return this._code;
27
+ }
28
+
29
+ public function get headerText():String
30
+ {
31
+ return this._headerText;
32
+ }
33
+
34
+ public function get body():String
35
+ {
36
+ return this._body;
37
+ }
38
+ }
39
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/ConnectedEvent.as ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class ConnectedEvent extends Event
7
+ {
8
+ public function ConnectedEvent()
9
+ {
10
+ super(Dict.CONNECTED);
11
+ }
12
+
13
+ }
14
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DatabaseEvent.as ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class DatabaseEvent
7
+ extends Event
8
+ {
9
+ private var _databases:Array;
10
+
11
+ public function DatabaseEvent()
12
+ {
13
+ super(Dict.DATABASES);
14
+ }
15
+
16
+ public function set databases(databases:Array):void
17
+ {
18
+ this._databases = databases;
19
+ }
20
+
21
+ public function get databases():Array
22
+ {
23
+ return this._databases;
24
+ }
25
+ }
26
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DefinitionEvent.as ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+ import com.adobe.protocols.dict.Definition;
6
+
7
+ public class DefinitionEvent
8
+ extends Event
9
+ {
10
+ private var _definition:Definition;
11
+
12
+ public function DefinitionEvent()
13
+ {
14
+ super(Dict.DEFINITION);
15
+ }
16
+
17
+ public function set definition(definition:Definition):void
18
+ {
19
+ this._definition = definition;
20
+ }
21
+
22
+ public function get definition():Definition
23
+ {
24
+ return this._definition;
25
+ }
26
+ }
27
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class DefinitionHeaderEvent
7
+ extends Event
8
+ {
9
+ private var _definitionCount:uint;
10
+
11
+ public function DefinitionHeaderEvent()
12
+ {
13
+ super(Dict.DEFINITION_HEADER);
14
+ }
15
+
16
+ public function set definitionCount(definitionCount:uint):void
17
+ {
18
+ this._definitionCount = definitionCount;
19
+ }
20
+
21
+ public function get definitionCount():uint
22
+ {
23
+ return this._definitionCount;
24
+ }
25
+ }
26
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DictionaryServerEvent.as ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class DictionaryServerEvent
7
+ extends Event
8
+ {
9
+ private var _servers:Array;
10
+
11
+ public function DictionaryServerEvent()
12
+ {
13
+ super(Dict.SERVERS);
14
+ }
15
+
16
+ public function set servers(servers:Array):void
17
+ {
18
+ this._servers = servers;
19
+ }
20
+
21
+ public function get servers():Array
22
+ {
23
+ return this._servers;
24
+ }
25
+ }
26
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/DisconnectedEvent.as ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class DisconnectedEvent extends Event
7
+ {
8
+ public function DisconnectedEvent()
9
+ {
10
+ super(Dict.DISCONNECTED);
11
+ }
12
+
13
+ }
14
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/ErrorEvent.as ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class ErrorEvent
7
+ extends Event
8
+ {
9
+ private var _code:uint;
10
+ private var _message:String;
11
+
12
+ public function ErrorEvent()
13
+ {
14
+ super(Dict.ERROR);
15
+ }
16
+
17
+ public function set code(code:uint):void
18
+ {
19
+ this._code = code;
20
+ }
21
+
22
+ public function set message(message:String):void
23
+ {
24
+ this._message = message;
25
+ }
26
+
27
+ public function get code():uint
28
+ {
29
+ return this._code;
30
+ }
31
+
32
+ public function get message():String
33
+ {
34
+ return this._message;
35
+ }
36
+ }
37
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/MatchEvent.as ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class MatchEvent
7
+ extends Event
8
+ {
9
+ private var _matches:Array;
10
+
11
+ public function MatchEvent()
12
+ {
13
+ super(Dict.MATCH);
14
+ }
15
+
16
+ public function set matches(matches:Array):void
17
+ {
18
+ this._matches = matches;
19
+ }
20
+
21
+ public function get matches():Array
22
+ {
23
+ return this._matches;
24
+ }
25
+ }
26
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/MatchStrategiesEvent.as ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class MatchStrategiesEvent
7
+ extends Event
8
+ {
9
+ private var _strategies:Array;
10
+
11
+ public function MatchStrategiesEvent()
12
+ {
13
+ super(Dict.MATCH_STRATEGIES);
14
+ }
15
+
16
+ public function set strategies(strategies:Array):void
17
+ {
18
+ this._strategies = strategies;
19
+ }
20
+
21
+ public function get strategies():Array
22
+ {
23
+ return this._strategies;
24
+ }
25
+ }
26
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/events/NoMatchEvent.as ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.events
2
+ {
3
+ import flash.events.Event;
4
+ import com.adobe.protocols.dict.Dict;
5
+
6
+ public class NoMatchEvent
7
+ extends Event
8
+ {
9
+ public function NoMatchEvent()
10
+ {
11
+ super(Dict.NO_MATCH);
12
+ }
13
+ }
14
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/util/CompleteResponseEvent.as ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.util
2
+ {
3
+ import flash.events.Event;
4
+
5
+ public class CompleteResponseEvent
6
+ extends Event
7
+ {
8
+ private var _response:String;
9
+
10
+ public function CompleteResponseEvent()
11
+ {
12
+ super(SocketHelper.COMPLETE_RESPONSE);
13
+ }
14
+
15
+ public function set response(response:String):void
16
+ {
17
+ this._response = response;
18
+ }
19
+
20
+ public function get response():String
21
+ {
22
+ return this._response;
23
+ }
24
+ }
25
+ }
skin/frontend/base/default/uploadfile/com/adobe/protocols/dict/util/SocketHelper.as ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package com.adobe.protocols.dict.util
2
+ {
3
+ import com.adobe.net.proxies.RFC2817Socket;
4
+ import flash.events.ProgressEvent;
5
+
6
+ public class SocketHelper
7
+ extends RFC2817Socket
8
+ {
9
+ private var terminator:String = "\r\n.\r\n";
10
+ private var buffer:String;
11
+ public static var COMPLETE_RESPONSE:String = "completeResponse";
12
+
13
+ public function SocketHelper()
14
+ {
15
+ super();
16
+ buffer = new String();
17
+ addEventListener(ProgressEvent.SOCKET_DATA, incomingData);
18
+ }
19
+
20
+ private function incomingData(event:ProgressEvent):void
21
+ {
22
+ buffer += readUTFBytes(bytesAvailable);
23
+ buffer = buffer.replace(/250[^\r\n]+\r\n/, ""); // Get rid of all 250s. Don't need them.
24
+ var codeStr:String = buffer.substring(0, 3);
25
+ if (!isNaN(parseInt(codeStr)))
26
+ {
27
+ var code:uint = uint(codeStr);
28
+ if (code == 150 || code >= 200)
29
+ {
30
+ buffer = buffer.replace("\r\n", this.terminator);
31
+ }
32
+ }
33
+
34
+ while (buffer.indexOf(this.terminator) != -1)
35
+ {
36
+ var chunk:String = buffer.substring(0, buffer.indexOf(this.terminator));
37
+ buffer = buffer.substring(chunk.length + this.terminator.length, buffer.length);
38
+ throwResponseEvent(chunk);
39
+ }
40
+ }
41
+
42
+ private function throwResponseEvent(response:String):void
43
+ {
44
+ var responseEvent:CompleteResponseEvent = new CompleteResponseEvent();
45
+ responseEvent.response = response;
46
+ dispatchEvent(responseEvent);
47
+ }
48
+ }
49
+ }
skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSON.as ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.serialization.json {
34
+
35
+ /**
36
+ * This class provides encoding and decoding of the JSON format.
37
+ *
38
+ * Example usage:
39
+ * <code>
40
+ * // create a JSON string from an internal object
41
+ * JSON.encode( myObject );
42
+ *
43
+ * // read a JSON string into an internal object
44
+ * var myObject:Object = JSON.decode( jsonString );
45
+ * </code>
46
+ */
47
+ public class JSON {
48
+
49
+
50
+ /**
51
+ * Encodes a object into a JSON string.
52
+ *
53
+ * @param o The object to create a JSON string for
54
+ * @return the JSON string representing o
55
+ * @langversion ActionScript 3.0
56
+ * @playerversion Flash 9.0
57
+ * @tiptext
58
+ */
59
+ public static function encode( o:Object ):String {
60
+
61
+ var encoder:JSONEncoder = new JSONEncoder( o );
62
+ return encoder.getString();
63
+
64
+ }
65
+
66
+ /**
67
+ * Decodes a JSON string into a native object.
68
+ *
69
+ * @param s The JSON string representing the object
70
+ * @return A native object as specified by s
71
+ * @throw JSONParseError
72
+ * @langversion ActionScript 3.0
73
+ * @playerversion Flash 9.0
74
+ * @tiptext
75
+ */
76
+ public static function decode( s:String ):* {
77
+
78
+ var decoder:JSONDecoder = new JSONDecoder( s )
79
+ return decoder.getValue();
80
+
81
+ }
82
+
83
+ }
84
+
85
+ }
skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONDecoder.as ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.serialization.json {
34
+
35
+ public class JSONDecoder {
36
+
37
+ /** The value that will get parsed from the JSON string */
38
+ private var value:*;
39
+
40
+ /** The tokenizer designated to read the JSON string */
41
+ private var tokenizer:JSONTokenizer;
42
+
43
+ /** The current token from the tokenizer */
44
+ private var token:JSONToken;
45
+
46
+ /**
47
+ * Constructs a new JSONDecoder to parse a JSON string
48
+ * into a native object.
49
+ *
50
+ * @param s The JSON string to be converted
51
+ * into a native object
52
+ * @langversion ActionScript 3.0
53
+ * @playerversion Flash 9.0
54
+ * @tiptext
55
+ */
56
+ public function JSONDecoder( s:String ) {
57
+
58
+ tokenizer = new JSONTokenizer( s );
59
+
60
+ nextToken();
61
+ value = parseValue();
62
+ }
63
+
64
+ /**
65
+ * Gets the internal object that was created by parsing
66
+ * the JSON string passed to the constructor.
67
+ *
68
+ * @return The internal object representation of the JSON
69
+ * string that was passed to the constructor
70
+ * @langversion ActionScript 3.0
71
+ * @playerversion Flash 9.0
72
+ * @tiptext
73
+ */
74
+ public function getValue():* {
75
+ return value;
76
+ }
77
+
78
+ /**
79
+ * Returns the next token from the tokenzier reading
80
+ * the JSON string
81
+ */
82
+ private function nextToken():JSONToken {
83
+ return token = tokenizer.getNextToken();
84
+ }
85
+
86
+ /**
87
+ * Attempt to parse an array
88
+ */
89
+ private function parseArray():Array {
90
+ // create an array internally that we're going to attempt
91
+ // to parse from the tokenizer
92
+ var a:Array = new Array();
93
+
94
+ // grab the next token from the tokenizer to move
95
+ // past the opening [
96
+ nextToken();
97
+
98
+ // check to see if we have an empty array
99
+ if ( token.type == JSONTokenType.RIGHT_BRACKET ) {
100
+ // we're done reading the array, so return it
101
+ return a;
102
+ }
103
+
104
+ // deal with elements of the array, and use an "infinite"
105
+ // loop because we could have any amount of elements
106
+ while ( true ) {
107
+ // read in the value and add it to the array
108
+ a.push ( parseValue() );
109
+
110
+ // after the value there should be a ] or a ,
111
+ nextToken();
112
+
113
+ if ( token.type == JSONTokenType.RIGHT_BRACKET ) {
114
+ // we're done reading the array, so return it
115
+ return a;
116
+ } else if ( token.type == JSONTokenType.COMMA ) {
117
+ // move past the comma and read another value
118
+ nextToken();
119
+ } else {
120
+ tokenizer.parseError( "Expecting ] or , but found " + token.value );
121
+ }
122
+ }
123
+ return null;
124
+ }
125
+
126
+ /**
127
+ * Attempt to parse an object
128
+ */
129
+ private function parseObject():Object {
130
+ // create the object internally that we're going to
131
+ // attempt to parse from the tokenizer
132
+ var o:Object = new Object();
133
+
134
+ // store the string part of an object member so
135
+ // that we can assign it a value in the object
136
+ var key:String
137
+
138
+ // grab the next token from the tokenizer
139
+ nextToken();
140
+
141
+ // check to see if we have an empty object
142
+ if ( token.type == JSONTokenType.RIGHT_BRACE ) {
143
+ // we're done reading the object, so return it
144
+ return o;
145
+ }
146
+
147
+ // deal with members of the object, and use an "infinite"
148
+ // loop because we could have any amount of members
149
+ while ( true ) {
150
+
151
+ if ( token.type == JSONTokenType.STRING ) {
152
+ // the string value we read is the key for the object
153
+ key = String( token.value );
154
+
155
+ // move past the string to see what's next
156
+ nextToken();
157
+
158
+ // after the string there should be a :
159
+ if ( token.type == JSONTokenType.COLON ) {
160
+
161
+ // move past the : and read/assign a value for the key
162
+ nextToken();
163
+ o[key] = parseValue();
164
+
165
+ // move past the value to see what's next
166
+ nextToken();
167
+
168
+ // after the value there's either a } or a ,
169
+ if ( token.type == JSONTokenType.RIGHT_BRACE ) {
170
+ // // we're done reading the object, so return it
171
+ return o;
172
+
173
+ } else if ( token.type == JSONTokenType.COMMA ) {
174
+ // skip past the comma and read another member
175
+ nextToken();
176
+ } else {
177
+ tokenizer.parseError( "Expecting } or , but found " + token.value );
178
+ }
179
+ } else {
180
+ tokenizer.parseError( "Expecting : but found " + token.value );
181
+ }
182
+ } else {
183
+ tokenizer.parseError( "Expecting string but found " + token.value );
184
+ }
185
+ }
186
+ return null;
187
+ }
188
+
189
+ /**
190
+ * Attempt to parse a value
191
+ */
192
+ private function parseValue():Object
193
+ {
194
+ // Catch errors when the input stream ends abruptly
195
+ if ( token == null )
196
+ {
197
+ tokenizer.parseError( "Unexpected end of input" );
198
+ }
199
+
200
+ switch ( token.type ) {
201
+ case JSONTokenType.LEFT_BRACE:
202
+ return parseObject();
203
+
204
+ case JSONTokenType.LEFT_BRACKET:
205
+ return parseArray();
206
+
207
+ case JSONTokenType.STRING:
208
+ case JSONTokenType.NUMBER:
209
+ case JSONTokenType.TRUE:
210
+ case JSONTokenType.FALSE:
211
+ case JSONTokenType.NULL:
212
+ return token.value;
213
+
214
+ default:
215
+ tokenizer.parseError( "Unexpected " + token.value );
216
+
217
+ }
218
+ return null;
219
+ }
220
+ }
221
+ }
skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONEncoder.as ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.serialization.json
34
+ {
35
+
36
+ import flash.utils.describeType;
37
+
38
+ public class JSONEncoder {
39
+
40
+ /** The string that is going to represent the object we're encoding */
41
+ private var jsonString:String;
42
+
43
+ /**
44
+ * Creates a new JSONEncoder.
45
+ *
46
+ * @param o The object to encode as a JSON string
47
+ * @langversion ActionScript 3.0
48
+ * @playerversion Flash 9.0
49
+ * @tiptext
50
+ */
51
+ public function JSONEncoder( value:* ) {
52
+ jsonString = convertToString( value );
53
+
54
+ }
55
+
56
+ /**
57
+ * Gets the JSON string from the encoder.
58
+ *
59
+ * @return The JSON string representation of the object
60
+ * that was passed to the constructor
61
+ * @langversion ActionScript 3.0
62
+ * @playerversion Flash 9.0
63
+ * @tiptext
64
+ */
65
+ public function getString():String {
66
+ return jsonString;
67
+ }
68
+
69
+ /**
70
+ * Converts a value to it's JSON string equivalent.
71
+ *
72
+ * @param value The value to convert. Could be any
73
+ * type (object, number, array, etc)
74
+ */
75
+ private function convertToString( value:* ):String {
76
+
77
+ // determine what value is and convert it based on it's type
78
+ if ( value is String ) {
79
+
80
+ // escape the string so it's formatted correctly
81
+ return escapeString( value as String );
82
+
83
+ } else if ( value is Number ) {
84
+
85
+ // only encode numbers that finate
86
+ return isFinite( value as Number) ? value.toString() : "null";
87
+
88
+ } else if ( value is Boolean ) {
89
+
90
+ // convert boolean to string easily
91
+ return value ? "true" : "false";
92
+
93
+ } else if ( value is Array ) {
94
+
95
+ // call the helper method to convert an array
96
+ return arrayToString( value as Array );
97
+
98
+ } else if ( value is Object && value != null ) {
99
+
100
+ // call the helper method to convert an object
101
+ return objectToString( value );
102
+ }
103
+ return "null";
104
+ }
105
+
106
+ /**
107
+ * Escapes a string accoding to the JSON specification.
108
+ *
109
+ * @param str The string to be escaped
110
+ * @return The string with escaped special characters
111
+ * according to the JSON specification
112
+ */
113
+ private function escapeString( str:String ):String {
114
+ // create a string to store the string's jsonstring value
115
+ var s:String = "";
116
+ // current character in the string we're processing
117
+ var ch:String;
118
+ // store the length in a local variable to reduce lookups
119
+ var len:Number = str.length;
120
+
121
+ // loop over all of the characters in the string
122
+ for ( var i:int = 0; i < len; i++ ) {
123
+
124
+ // examine the character to determine if we have to escape it
125
+ ch = str.charAt( i );
126
+ switch ( ch ) {
127
+
128
+ case '"': // quotation mark
129
+ s += "\\\"";
130
+ break;
131
+
132
+ //case '/': // solidus
133
+ // s += "\\/";
134
+ // break;
135
+
136
+ case '\\': // reverse solidus
137
+ s += "\\\\";
138
+ break;
139
+
140
+ case '\b': // bell
141
+ s += "\\b";
142
+ break;
143
+
144
+ case '\f': // form feed
145
+ s += "\\f";
146
+ break;
147
+
148
+ case '\n': // newline
149
+ s += "\\n";
150
+ break;
151
+
152
+ case '\r': // carriage return
153
+ s += "\\r";
154
+ break;
155
+
156
+ case '\t': // horizontal tab
157
+ s += "\\t";
158
+ break;
159
+
160
+ default: // everything else
161
+
162
+ // check for a control character and escape as unicode
163
+ if ( ch < ' ' ) {
164
+ // get the hex digit(s) of the character (either 1 or 2 digits)
165
+ var hexCode:String = ch.charCodeAt( 0 ).toString( 16 );
166
+
167
+ // ensure that there are 4 digits by adjusting
168
+ // the # of zeros accordingly.
169
+ var zeroPad:String = hexCode.length == 2 ? "00" : "000";
170
+
171
+ // create the unicode escape sequence with 4 hex digits
172
+ s += "\\u" + zeroPad + hexCode;
173
+ } else {
174
+
175
+ // no need to do any special encoding, just pass-through
176
+ s += ch;
177
+
178
+ }
179
+ } // end switch
180
+
181
+ } // end for loop
182
+
183
+ return "\"" + s + "\"";
184
+ }
185
+
186
+ /**
187
+ * Converts an array to it's JSON string equivalent
188
+ *
189
+ * @param a The array to convert
190
+ * @return The JSON string representation of <code>a</code>
191
+ */
192
+ private function arrayToString( a:Array ):String {
193
+ // create a string to store the array's jsonstring value
194
+ var s:String = "";
195
+
196
+ // loop over the elements in the array and add their converted
197
+ // values to the string
198
+ for ( var i:int = 0; i < a.length; i++ ) {
199
+ // when the length is 0 we're adding the first element so
200
+ // no comma is necessary
201
+ if ( s.length > 0 ) {
202
+ // we've already added an element, so add the comma separator
203
+ s += ","
204
+ }
205
+
206
+ // convert the value to a string
207
+ s += convertToString( a[i] );
208
+ }
209
+
210
+ // KNOWN ISSUE: In ActionScript, Arrays can also be associative
211
+ // objects and you can put anything in them, ie:
212
+ // myArray["foo"] = "bar";
213
+ //
214
+ // These properties aren't picked up in the for loop above because
215
+ // the properties don't correspond to indexes. However, we're
216
+ // sort of out luck because the JSON specification doesn't allow
217
+ // these types of array properties.
218
+ //
219
+ // So, if the array was also used as an associative object, there
220
+ // may be some values in the array that don't get properly encoded.
221
+ //
222
+ // A possible solution is to instead encode the Array as an Object
223
+ // but then it won't get decoded correctly (and won't be an
224
+ // Array instance)
225
+
226
+ // close the array and return it's string value
227
+ return "[" + s + "]";
228
+ }
229
+
230
+ /**
231
+ * Converts an object to it's JSON string equivalent
232
+ *
233
+ * @param o The object to convert
234
+ * @return The JSON string representation of <code>o</code>
235
+ */
236
+ private function objectToString( o:Object ):String
237
+ {
238
+ // create a string to store the object's jsonstring value
239
+ var s:String = "";
240
+
241
+ // determine if o is a class instance or a plain object
242
+ var classInfo:XML = describeType( o );
243
+ if ( classInfo.@name.toString() == "Object" )
244
+ {
245
+ // the value of o[key] in the loop below - store this
246
+ // as a variable so we don't have to keep looking up o[key]
247
+ // when testing for valid values to convert
248
+ var value:Object;
249
+
250
+ // loop over the keys in the object and add their converted
251
+ // values to the string
252
+ for ( var key:String in o )
253
+ {
254
+ // assign value to a variable for quick lookup
255
+ value = o[key];
256
+
257
+ // don't add function's to the JSON string
258
+ if ( value is Function )
259
+ {
260
+ // skip this key and try another
261
+ continue;
262
+ }
263
+
264
+ // when the length is 0 we're adding the first item so
265
+ // no comma is necessary
266
+ if ( s.length > 0 ) {
267
+ // we've already added an item, so add the comma separator
268
+ s += ","
269
+ }
270
+
271
+ s += escapeString( key ) + ":" + convertToString( value );
272
+ }
273
+ }
274
+ else // o is a class instance
275
+ {
276
+ // Loop over all of the variables and accessors in the class and
277
+ // serialize them along with their values.
278
+ for each ( var v:XML in classInfo..*.( name() == "variable" || name() == "accessor" ) )
279
+ {
280
+ // When the length is 0 we're adding the first item so
281
+ // no comma is necessary
282
+ if ( s.length > 0 ) {
283
+ // We've already added an item, so add the comma separator
284
+ s += ","
285
+ }
286
+
287
+ s += escapeString( v.@name.toString() ) + ":"
288
+ + convertToString( o[ v.@name ] );
289
+ }
290
+
291
+ }
292
+
293
+ return "{" + s + "}";
294
+ }
295
+
296
+
297
+ }
298
+
299
+ }
skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONParseError.as ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.serialization.json {
34
+
35
+ /**
36
+ *
37
+ *
38
+ */
39
+ public class JSONParseError extends Error {
40
+
41
+ /** The location in the string where the error occurred */
42
+ private var _location:int;
43
+
44
+ /** The string in which the parse error occurred */
45
+ private var _text:String;
46
+
47
+ /**
48
+ * Constructs a new JSONParseError.
49
+ *
50
+ * @param message The error message that occured during parsing
51
+ * @langversion ActionScript 3.0
52
+ * @playerversion Flash 9.0
53
+ * @tiptext
54
+ */
55
+ public function JSONParseError( message:String = "", location:int = 0, text:String = "") {
56
+ super( message );
57
+ name = "JSONParseError";
58
+ _location = location;
59
+ _text = text;
60
+ }
61
+
62
+ /**
63
+ * Provides read-only access to the location variable.
64
+ *
65
+ * @return The location in the string where the error occurred
66
+ * @langversion ActionScript 3.0
67
+ * @playerversion Flash 9.0
68
+ * @tiptext
69
+ */
70
+ public function get location():int {
71
+ return _location;
72
+ }
73
+
74
+ /**
75
+ * Provides read-only access to the text variable.
76
+ *
77
+ * @return The string in which the error occurred
78
+ * @langversion ActionScript 3.0
79
+ * @playerversion Flash 9.0
80
+ * @tiptext
81
+ */
82
+ public function get text():String {
83
+ return _text;
84
+ }
85
+ }
86
+
87
+ }
skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONToken.as ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.serialization.json {
34
+
35
+ public class JSONToken {
36
+
37
+ private var _type:int;
38
+ private var _value:Object;
39
+
40
+ /**
41
+ * Creates a new JSONToken with a specific token type and value.
42
+ *
43
+ * @param type The JSONTokenType of the token
44
+ * @param value The value of the token
45
+ * @langversion ActionScript 3.0
46
+ * @playerversion Flash 9.0
47
+ * @tiptext
48
+ */
49
+ public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) {
50
+ _type = type;
51
+ _value = value;
52
+ }
53
+
54
+ /**
55
+ * Returns the type of the token.
56
+ *
57
+ * @see com.adobe.serialization.json.JSONTokenType
58
+ * @langversion ActionScript 3.0
59
+ * @playerversion Flash 9.0
60
+ * @tiptext
61
+ */
62
+ public function get type():int {
63
+ return _type;
64
+ }
65
+
66
+ /**
67
+ * Sets the type of the token.
68
+ *
69
+ * @see com.adobe.serialization.json.JSONTokenType
70
+ * @langversion ActionScript 3.0
71
+ * @playerversion Flash 9.0
72
+ * @tiptext
73
+ */
74
+ public function set type( value:int ):void {
75
+ _type = value;
76
+ }
77
+
78
+ /**
79
+ * Gets the value of the token
80
+ *
81
+ * @see com.adobe.serialization.json.JSONTokenType
82
+ * @langversion ActionScript 3.0
83
+ * @playerversion Flash 9.0
84
+ * @tiptext
85
+ */
86
+ public function get value():Object {
87
+ return _value;
88
+ }
89
+
90
+ /**
91
+ * Sets the value of the token
92
+ *
93
+ * @see com.adobe.serialization.json.JSONTokenType
94
+ * @langversion ActionScript 3.0
95
+ * @playerversion Flash 9.0
96
+ * @tiptext
97
+ */
98
+ public function set value ( v:Object ):void {
99
+ _value = v;
100
+ }
101
+
102
+ }
103
+
104
+ }
skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONTokenType.as ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.serialization.json {
34
+
35
+ /**
36
+ * Class containing constant values for the different types
37
+ * of tokens in a JSON encoded string.
38
+ */
39
+ public class JSONTokenType {
40
+
41
+ public static const UNKNOWN:int = -1;
42
+
43
+ public static const COMMA:int = 0;
44
+
45
+ public static const LEFT_BRACE:int = 1;
46
+
47
+ public static const RIGHT_BRACE:int = 2;
48
+
49
+ public static const LEFT_BRACKET:int = 3;
50
+
51
+ public static const RIGHT_BRACKET:int = 4;
52
+
53
+ public static const COLON:int = 6;
54
+
55
+ public static const TRUE:int = 7;
56
+
57
+ public static const FALSE:int = 8;
58
+
59
+ public static const NULL:int = 9;
60
+
61
+ public static const STRING:int = 10;
62
+
63
+ public static const NUMBER:int = 11;
64
+
65
+ }
66
+
67
+ }
skin/frontend/base/default/uploadfile/com/adobe/serialization/json/JSONTokenizer.as ADDED
@@ -0,0 +1,583 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.serialization.json {
34
+
35
+ public class JSONTokenizer {
36
+
37
+ /** The object that will get parsed from the JSON string */
38
+ private var obj:Object;
39
+
40
+ /** The JSON string to be parsed */
41
+ private var jsonString:String;
42
+
43
+ /** The current parsing location in the JSON string */
44
+ private var loc:int;
45
+
46
+ /** The current character in the JSON string during parsing */
47
+ private var ch:String;
48
+
49
+ /**
50
+ * Constructs a new JSONDecoder to parse a JSON string
51
+ * into a native object.
52
+ *
53
+ * @param s The JSON string to be converted
54
+ * into a native object
55
+ */
56
+ public function JSONTokenizer( s:String ) {
57
+ jsonString = s;
58
+ loc = 0;
59
+
60
+ // prime the pump by getting the first character
61
+ nextChar();
62
+ }
63
+
64
+ /**
65
+ * Gets the next token in the input sting and advances
66
+ * the character to the next character after the token
67
+ */
68
+ public function getNextToken():JSONToken {
69
+ var token:JSONToken = new JSONToken();
70
+
71
+ // skip any whitespace / comments since the last
72
+ // token was read
73
+ skipIgnored();
74
+
75
+ // examine the new character and see what we have...
76
+ switch ( ch ) {
77
+
78
+ case '{':
79
+ token.type = JSONTokenType.LEFT_BRACE;
80
+ token.value = '{';
81
+ nextChar();
82
+ break
83
+
84
+ case '}':
85
+ token.type = JSONTokenType.RIGHT_BRACE;
86
+ token.value = '}';
87
+ nextChar();
88
+ break
89
+
90
+ case '[':
91
+ token.type = JSONTokenType.LEFT_BRACKET;
92
+ token.value = '[';
93
+ nextChar();
94
+ break
95
+
96
+ case ']':
97
+ token.type = JSONTokenType.RIGHT_BRACKET;
98
+ token.value = ']';
99
+ nextChar();
100
+ break
101
+
102
+ case ',':
103
+ token.type = JSONTokenType.COMMA;
104
+ token.value = ',';
105
+ nextChar();
106
+ break
107
+
108
+ case ':':
109
+ token.type = JSONTokenType.COLON;
110
+ token.value = ':';
111
+ nextChar();
112
+ break;
113
+
114
+ case 't': // attempt to read true
115
+ var possibleTrue:String = "t" + nextChar() + nextChar() + nextChar();
116
+
117
+ if ( possibleTrue == "true" ) {
118
+ token.type = JSONTokenType.TRUE;
119
+ token.value = true;
120
+ nextChar();
121
+ } else {
122
+ parseError( "Expecting 'true' but found " + possibleTrue );
123
+ }
124
+
125
+ break;
126
+
127
+ case 'f': // attempt to read false
128
+ var possibleFalse:String = "f" + nextChar() + nextChar() + nextChar() + nextChar();
129
+
130
+ if ( possibleFalse == "false" ) {
131
+ token.type = JSONTokenType.FALSE;
132
+ token.value = false;
133
+ nextChar();
134
+ } else {
135
+ parseError( "Expecting 'false' but found " + possibleFalse );
136
+ }
137
+
138
+ break;
139
+
140
+ case 'n': // attempt to read null
141
+
142
+ var possibleNull:String = "n" + nextChar() + nextChar() + nextChar();
143
+
144
+ if ( possibleNull == "null" ) {
145
+ token.type = JSONTokenType.NULL;
146
+ token.value = null;
147
+ nextChar();
148
+ } else {
149
+ parseError( "Expecting 'null' but found " + possibleNull );
150
+ }
151
+
152
+ break;
153
+
154
+ case '"': // the start of a string
155
+ token = readString();
156
+ break;
157
+
158
+ default:
159
+ // see if we can read a number
160
+ if ( isDigit( ch ) || ch == '-' ) {
161
+ token = readNumber();
162
+ } else if ( ch == '' ) {
163
+ // check for reading past the end of the string
164
+ return null;
165
+ } else {
166
+ // not sure what was in the input string - it's not
167
+ // anything we expected
168
+ parseError( "Unexpected " + ch + " encountered" );
169
+ }
170
+ }
171
+
172
+ return token;
173
+ }
174
+
175
+ /**
176
+ * Attempts to read a string from the input string. Places
177
+ * the character location at the first character after the
178
+ * string. It is assumed that ch is " before this method is called.
179
+ *
180
+ * @return the JSONToken with the string value if a string could
181
+ * be read. Throws an error otherwise.
182
+ */
183
+ private function readString():JSONToken {
184
+ // the token for the string we'll try to read
185
+ var token:JSONToken = new JSONToken();
186
+ token.type = JSONTokenType.STRING;
187
+
188
+ // the string to store the string we'll try to read
189
+ var string:String = "";
190
+
191
+ // advance past the first "
192
+ nextChar();
193
+
194
+ while ( ch != '"' && ch != '' ) {
195
+
196
+ // unescape the escape sequences in the string
197
+ if ( ch == '\\' ) {
198
+
199
+ // get the next character so we know what
200
+ // to unescape
201
+ nextChar();
202
+
203
+ switch ( ch ) {
204
+
205
+ case '"': // quotation mark
206
+ string += '"';
207
+ break;
208
+
209
+ case '/': // solidus
210
+ string += "/";
211
+ break;
212
+
213
+ case '\\': // reverse solidus
214
+ string += '\\';
215
+ break;
216
+
217
+ case 'b': // bell
218
+ string += '\b';
219
+ break;
220
+
221
+ case 'f': // form feed
222
+ string += '\f';
223
+ break;
224
+
225
+ case 'n': // newline
226
+ string += '\n';
227
+ break;
228
+
229
+ case 'r': // carriage return
230
+ string += '\r';
231
+ break;
232
+
233
+ case 't': // horizontal tab
234
+ string += '\t'
235
+ break;
236
+
237
+ case 'u':
238
+ // convert a unicode escape sequence
239
+ // to it's character value - expecting
240
+ // 4 hex digits
241
+
242
+ // save the characters as a string we'll convert to an int
243
+ var hexValue:String = "";
244
+
245
+ // try to find 4 hex characters
246
+ for ( var i:int = 0; i < 4; i++ ) {
247
+ // get the next character and determine
248
+ // if it's a valid hex digit or not
249
+ if ( !isHexDigit( nextChar() ) ) {
250
+ parseError( " Excepted a hex digit, but found: " + ch );
251
+ }
252
+ // valid, add it to the value
253
+ hexValue += ch;
254
+ }
255
+
256
+ // convert hexValue to an integer, and use that
257
+ // integrer value to create a character to add
258
+ // to our string.
259
+ string += String.fromCharCode( parseInt( hexValue, 16 ) );
260
+
261
+ break;
262
+
263
+ default:
264
+ // couldn't unescape the sequence, so just
265
+ // pass it through
266
+ string += '\\' + ch;
267
+
268
+ }
269
+
270
+ } else {
271
+ // didn't have to unescape, so add the character to the string
272
+ string += ch;
273
+
274
+ }
275
+
276
+ // move to the next character
277
+ nextChar();
278
+
279
+ }
280
+
281
+ // we read past the end of the string without closing it, which
282
+ // is a parse error
283
+ if ( ch == '' ) {
284
+ parseError( "Unterminated string literal" );
285
+ }
286
+
287
+ // move past the closing " in the input string
288
+ nextChar();
289
+
290
+ // attach to the string to the token so we can return it
291
+ token.value = string;
292
+
293
+ return token;
294
+ }
295
+
296
+ /**
297
+ * Attempts to read a number from the input string. Places
298
+ * the character location at the first character after the
299
+ * number.
300
+ *
301
+ * @return The JSONToken with the number value if a number could
302
+ * be read. Throws an error otherwise.
303
+ */
304
+ private function readNumber():JSONToken {
305
+ // the token for the number we'll try to read
306
+ var token:JSONToken = new JSONToken();
307
+ token.type = JSONTokenType.NUMBER;
308
+
309
+ // the string to accumulate the number characters
310
+ // into that we'll convert to a number at the end
311
+ var input:String = "";
312
+
313
+ // check for a negative number
314
+ if ( ch == '-' ) {
315
+ input += '-';
316
+ nextChar();
317
+ }
318
+
319
+ // the number must start with a digit
320
+ if ( !isDigit( ch ) )
321
+ {
322
+ parseError( "Expecting a digit" );
323
+ }
324
+
325
+ // 0 can only be the first digit if it
326
+ // is followed by a decimal point
327
+ if ( ch == '0' )
328
+ {
329
+ input += ch;
330
+ nextChar();
331
+
332
+ // make sure no other digits come after 0
333
+ if ( isDigit( ch ) )
334
+ {
335
+ parseError( "A digit cannot immediately follow 0" );
336
+ }
337
+ // Commented out - this should only be available when "strict" is false
338
+ // // unless we have 0x which starts a hex number\
339
+ // else if ( ch == 'x' )
340
+ // {
341
+ // // include the x in the input
342
+ // input += ch;
343
+ // nextChar();
344
+ //
345
+ // // need at least one hex digit after 0x to
346
+ // // be valid
347
+ // if ( isHexDigit( ch ) )
348
+ // {
349
+ // input += ch;
350
+ // nextChar();
351
+ // }
352
+ // else
353
+ // {
354
+ // parseError( "Number in hex format require at least one hex digit after \"0x\"" );
355
+ // }
356
+ //
357
+ // // consume all of the hex values
358
+ // while ( isHexDigit( ch ) )
359
+ // {
360
+ // input += ch;
361
+ // nextChar();
362
+ // }
363
+ // }
364
+ }
365
+ else
366
+ {
367
+ // read numbers while we can
368
+ while ( isDigit( ch ) ) {
369
+ input += ch;
370
+ nextChar();
371
+ }
372
+ }
373
+
374
+ // check for a decimal value
375
+ if ( ch == '.' ) {
376
+ input += '.';
377
+ nextChar();
378
+
379
+ // after the decimal there has to be a digit
380
+ if ( !isDigit( ch ) )
381
+ {
382
+ parseError( "Expecting a digit" );
383
+ }
384
+
385
+ // read more numbers to get the decimal value
386
+ while ( isDigit( ch ) ) {
387
+ input += ch;
388
+ nextChar();
389
+ }
390
+ }
391
+
392
+ // check for scientific notation
393
+ if ( ch == 'e' || ch == 'E' )
394
+ {
395
+ input += "e"
396
+ nextChar();
397
+ // check for sign
398
+ if ( ch == '+' || ch == '-' )
399
+ {
400
+ input += ch;
401
+ nextChar();
402
+ }
403
+
404
+ // require at least one number for the exponent
405
+ // in this case
406
+ if ( !isDigit( ch ) )
407
+ {
408
+ parseError( "Scientific notation number needs exponent value" );
409
+ }
410
+
411
+ // read in the exponent
412
+ while ( isDigit( ch ) )
413
+ {
414
+ input += ch;
415
+ nextChar();
416
+ }
417
+ }
418
+
419
+ // convert the string to a number value
420
+ var num:Number = Number( input );
421
+
422
+ if ( isFinite( num ) && !isNaN( num ) ) {
423
+ token.value = num;
424
+ return token;
425
+ } else {
426
+ parseError( "Number " + num + " is not valid!" );
427
+ }
428
+ return null;
429
+ }
430
+
431
+ /**
432
+ * Reads the next character in the input
433
+ * string and advances the character location.
434
+ *
435
+ * @return The next character in the input string, or
436
+ * null if we've read past the end.
437
+ */
438
+ private function nextChar():String {
439
+ return ch = jsonString.charAt( loc++ );
440
+ }
441
+
442
+ /**
443
+ * Advances the character location past any
444
+ * sort of white space and comments
445
+ */
446
+ private function skipIgnored():void
447
+ {
448
+ var originalLoc:int;
449
+
450
+ // keep trying to skip whitespace and comments as long
451
+ // as we keep advancing past the original location
452
+ do
453
+ {
454
+ originalLoc = loc;
455
+ skipWhite();
456
+ skipComments();
457
+ }
458
+ while ( originalLoc != loc );
459
+ }
460
+
461
+ /**
462
+ * Skips comments in the input string, either
463
+ * single-line or multi-line. Advances the character
464
+ * to the first position after the end of the comment.
465
+ */
466
+ private function skipComments():void {
467
+ if ( ch == '/' ) {
468
+ // Advance past the first / to find out what type of comment
469
+ nextChar();
470
+ switch ( ch ) {
471
+ case '/': // single-line comment, read through end of line
472
+
473
+ // Loop over the characters until we find
474
+ // a newline or until there's no more characters left
475
+ do {
476
+ nextChar();
477
+ } while ( ch != '\n' && ch != '' )
478
+
479
+ // move past the \n
480
+ nextChar();
481
+
482
+ break;
483
+
484
+ case '*': // multi-line comment, read until closing */
485
+
486
+ // move past the opening *
487
+ nextChar();
488
+
489
+ // try to find a trailing */
490
+ while ( true ) {
491
+ if ( ch == '*' ) {
492
+ // check to see if we have a closing /
493
+ nextChar();
494
+ if ( ch == '/') {
495
+ // move past the end of the closing */
496
+ nextChar();
497
+ break;
498
+ }
499
+ } else {
500
+ // move along, looking if the next character is a *
501
+ nextChar();
502
+ }
503
+
504
+ // when we're here we've read past the end of
505
+ // the string without finding a closing */, so error
506
+ if ( ch == '' ) {
507
+ parseError( "Multi-line comment not closed" );
508
+ }
509
+ }
510
+
511
+ break;
512
+
513
+ // Can't match a comment after a /, so it's a parsing error
514
+ default:
515
+ parseError( "Unexpected " + ch + " encountered (expecting '/' or '*' )" );
516
+ }
517
+ }
518
+
519
+ }
520
+
521
+
522
+ /**
523
+ * Skip any whitespace in the input string and advances
524
+ * the character to the first character after any possible
525
+ * whitespace.
526
+ */
527
+ private function skipWhite():void {
528
+
529
+ // As long as there are spaces in the input
530
+ // stream, advance the current location pointer
531
+ // past them
532
+ while ( isWhiteSpace( ch ) ) {
533
+ nextChar();
534
+ }
535
+
536
+ }
537
+
538
+ /**
539
+ * Determines if a character is whitespace or not.
540
+ *
541
+ * @return True if the character passed in is a whitespace
542
+ * character
543
+ */
544
+ private function isWhiteSpace( ch:String ):Boolean {
545
+ return ( ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' );
546
+ }
547
+
548
+ /**
549
+ * Determines if a character is a digit [0-9].
550
+ *
551
+ * @return True if the character passed in is a digit
552
+ */
553
+ private function isDigit( ch:String ):Boolean {
554
+ return ( ch >= '0' && ch <= '9' );
555
+ }
556
+
557
+ /**
558
+ * Determines if a character is a digit [0-9].
559
+ *
560
+ * @return True if the character passed in is a digit
561
+ */
562
+ private function isHexDigit( ch:String ):Boolean {
563
+ // get the uppercase value of ch so we only have
564
+ // to compare the value between 'A' and 'F'
565
+ var uc:String = ch.toUpperCase();
566
+
567
+ // a hex digit is a digit of A-F, inclusive ( using
568
+ // our uppercase constraint )
569
+ return ( isDigit( ch ) || ( uc >= 'A' && uc <= 'F' ) );
570
+ }
571
+
572
+ /**
573
+ * Raises a parsing error with a specified message, tacking
574
+ * on the error location and the original string.
575
+ *
576
+ * @param message The message indicating why the error occurred
577
+ */
578
+ public function parseError( message:String ):void {
579
+ throw new JSONParseError( message, loc, jsonString );
580
+ }
581
+ }
582
+
583
+ }
skin/frontend/base/default/uploadfile/com/adobe/utils/ArrayUtil.as ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.utils
34
+ {
35
+
36
+ /**
37
+ * Class that contains static utility methods for manipulating and working
38
+ * with Arrays.
39
+ *
40
+ * Note that all APIs assume that they are working with well formed arrays.
41
+ * i.e. they will only manipulate indexed values.
42
+ *
43
+ * @langversion ActionScript 3.0
44
+ * @playerversion Flash 9.0
45
+ * @tiptext
46
+ */
47
+ public class ArrayUtil
48
+ {
49
+
50
+ /**
51
+ * Determines whether the specified array contains the specified value.
52
+ *
53
+ * @param arr The array that will be checked for the specified value.
54
+ *
55
+ * @param value The object which will be searched for within the array
56
+ *
57
+ * @return True if the array contains the value, False if it does not.
58
+ *
59
+ * @langversion ActionScript 3.0
60
+ * @playerversion Flash 9.0
61
+ * @tiptext
62
+ */
63
+ public static function arrayContainsValue(arr:Array, value:Object):Boolean
64
+ {
65
+ return (arr.indexOf(value) != -1);
66
+ }
67
+
68
+ /**
69
+ * Remove all instances of the specified value from the array,
70
+ *
71
+ * @param arr The array from which the value will be removed
72
+ *
73
+ * @param value The object that will be removed from the array.
74
+ *
75
+ * @langversion ActionScript 3.0
76
+ * @playerversion Flash 9.0
77
+ * @tiptext
78
+ */
79
+ public static function removeValueFromArray(arr:Array, value:Object):void
80
+ {
81
+ var len:uint = arr.length;
82
+
83
+ for(var i:Number = len; i > -1; i--)
84
+ {
85
+ if(arr[i] === value)
86
+ {
87
+ arr.splice(i, 1);
88
+ }
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Create a new array that only contains unique instances of objects
94
+ * in the specified array.
95
+ *
96
+ * Basically, this can be used to remove duplication object instances
97
+ * from an array
98
+ *
99
+ * @param arr The array which contains the values that will be used to
100
+ * create the new array that contains no duplicate values.
101
+ *
102
+ * @return A new array which only contains unique items from the specified
103
+ * array.
104
+ *
105
+ * @langversion ActionScript 3.0
106
+ * @playerversion Flash 9.0
107
+ * @tiptext
108
+ */
109
+ public static function createUniqueCopy(a:Array):Array
110
+ {
111
+ var newArray:Array = new Array();
112
+
113
+ var len:Number = a.length;
114
+ var item:Object;
115
+
116
+ for (var i:uint = 0; i < len; ++i)
117
+ {
118
+ item = a[i];
119
+
120
+ if(ArrayUtil.arrayContainsValue(newArray, item))
121
+ {
122
+ continue;
123
+ }
124
+
125
+ newArray.push(item);
126
+ }
127
+
128
+ return newArray;
129
+ }
130
+
131
+ /**
132
+ * Creates a copy of the specified array.
133
+ *
134
+ * Note that the array returned is a new array but the items within the
135
+ * array are not copies of the items in the original array (but rather
136
+ * references to the same items)
137
+ *
138
+ * @param arr The array that will be copies
139
+ *
140
+ * @return A new array which contains the same items as the array passed
141
+ * in.
142
+ *
143
+ * @langversion ActionScript 3.0
144
+ * @playerversion Flash 9.0
145
+ * @tiptext
146
+ */
147
+ public static function copyArray(arr:Array):Array
148
+ {
149
+ return arr.slice();
150
+ }
151
+
152
+ /**
153
+ * Compares two arrays and returns a boolean indicating whether the arrays
154
+ * contain the same values at the same indexes.
155
+ *
156
+ * @param arr1 The first array that will be compared to the second.
157
+ *
158
+ * @param arr2 The second array that will be compared to the first.
159
+ *
160
+ * @return True if the arrays contains the same values at the same indexes.
161
+ False if they do not.
162
+ *
163
+ * @langversion ActionScript 3.0
164
+ * @playerversion Flash 9.0
165
+ * @tiptext
166
+ */
167
+ public static function arraysAreEqual(arr1:Array, arr2:Array):Boolean
168
+ {
169
+ if(arr1.length != arr2.length)
170
+ {
171
+ return false;
172
+ }
173
+
174
+ var len:Number = arr1.length;
175
+
176
+ for(var i:Number = 0; i < len; i++)
177
+ {
178
+ if(arr1[i] !== arr2[i])
179
+ {
180
+ return false;
181
+ }
182
+ }
183
+
184
+ return true;
185
+ }
186
+ }
187
+ }
skin/frontend/base/default/uploadfile/com/adobe/utils/DateUtil.as ADDED
@@ -0,0 +1,699 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.utils
34
+ {
35
+ import mx.formatters.DateBase;
36
+
37
+ /**
38
+ * Class that contains static utility methods for manipulating and working
39
+ * with Dates.
40
+ *
41
+ * @langversion ActionScript 3.0
42
+ * @playerversion Flash 9.0
43
+ * @tiptext
44
+ */
45
+ public class DateUtil
46
+ {
47
+
48
+ /**
49
+ * Returns the English Short Month name (3 letters) for the Month that
50
+ * the Date represents.
51
+ *
52
+ * @param d The Date instance whose month will be used to retrieve the
53
+ * short month name.
54
+ *
55
+ * @return An English 3 Letter Month abbreviation.
56
+ *
57
+ * @langversion ActionScript 3.0
58
+ * @playerversion Flash 9.0
59
+ * @tiptext
60
+ *
61
+ * @see SHORT_MONTH
62
+ */
63
+ public static function getShortMonthName(d:Date):String
64
+ {
65
+ return DateBase.monthNamesShort[d.getMonth()];
66
+ }
67
+
68
+ /**
69
+ * Returns the index of the month that the short month name string
70
+ * represents.
71
+ *
72
+ * @param m The 3 letter abbreviation representing a short month name.
73
+ *
74
+ * @param Optional parameter indicating whether the search should be case
75
+ * sensitive
76
+ *
77
+ * @return A int that represents that month represented by the specifed
78
+ * short name.
79
+ *
80
+ * @langversion ActionScript 3.0
81
+ * @playerversion Flash 9.0
82
+ * @tiptext
83
+ *
84
+ * @see SHORT_MONTH
85
+ */
86
+ public static function getShortMonthIndex(m:String):int
87
+ {
88
+ return DateBase.monthNamesShort.indexOf(m);
89
+ }
90
+
91
+ /**
92
+ * Returns the English full Month name for the Month that
93
+ * the Date represents.
94
+ *
95
+ * @param d The Date instance whose month will be used to retrieve the
96
+ * full month name.
97
+ *
98
+ * @return An English full month name.
99
+ *
100
+ * @langversion ActionScript 3.0
101
+ * @playerversion Flash 9.0
102
+ * @tiptext
103
+ *
104
+ * @see FULL_MONTH
105
+ */
106
+ public static function getFullMonthName(d:Date):String
107
+ {
108
+ return DateBase.monthNamesLong[d.getMonth()];
109
+ }
110
+
111
+ /**
112
+ * Returns the index of the month that the full month name string
113
+ * represents.
114
+ *
115
+ * @param m A full month name.
116
+ *
117
+ * @return A int that represents that month represented by the specifed
118
+ * full month name.
119
+ *
120
+ * @langversion ActionScript 3.0
121
+ * @playerversion Flash 9.0
122
+ * @tiptext
123
+ *
124
+ * @see FULL_MONTH
125
+ */
126
+ public static function getFullMonthIndex(m:String):int
127
+ {
128
+ return DateBase.monthNamesLong.indexOf(m);
129
+ }
130
+
131
+ /**
132
+ * Returns the English Short Day name (3 letters) for the day that
133
+ * the Date represents.
134
+ *
135
+ * @param d The Date instance whose day will be used to retrieve the
136
+ * short day name.
137
+ *
138
+ * @return An English 3 Letter day abbreviation.
139
+ *
140
+ * @langversion ActionScript 3.0
141
+ * @playerversion Flash 9.0
142
+ * @tiptext
143
+ *
144
+ * @see SHORT_DAY
145
+ */
146
+ public static function getShortDayName(d:Date):String
147
+ {
148
+ return DateBase.dayNamesShort[d.getDay()];
149
+ }
150
+
151
+ /**
152
+ * Returns the index of the day that the short day name string
153
+ * represents.
154
+ *
155
+ * @param m A short day name.
156
+ *
157
+ * @return A int that represents that short day represented by the specifed
158
+ * full month name.
159
+ *
160
+ * @langversion ActionScript 3.0
161
+ * @playerversion Flash 9.0
162
+ * @tiptext
163
+ *
164
+ * @see SHORT_DAY
165
+ */
166
+ public static function getShortDayIndex(d:String):int
167
+ {
168
+ return DateBase.dayNamesShort.indexOf(d);
169
+ }
170
+
171
+ /**
172
+ * Returns the English full day name for the day that
173
+ * the Date represents.
174
+ *
175
+ * @param d The Date instance whose day will be used to retrieve the
176
+ * full day name.
177
+ *
178
+ * @return An English full day name.
179
+ *
180
+ * @langversion ActionScript 3.0
181
+ * @playerversion Flash 9.0
182
+ * @tiptext
183
+ *
184
+ * @see FULL_DAY
185
+ */
186
+ public static function getFullDayName(d:Date):String
187
+ {
188
+ return DateBase.dayNamesLong[d.getDay()];
189
+ }
190
+
191
+ /**
192
+ * Returns the index of the day that the full day name string
193
+ * represents.
194
+ *
195
+ * @param m A full day name.
196
+ *
197
+ * @return A int that represents that full day represented by the specifed
198
+ * full month name.
199
+ *
200
+ * @langversion ActionScript 3.0
201
+ * @playerversion Flash 9.0
202
+ * @tiptext
203
+ *
204
+ * @see FULL_DAY
205
+ */
206
+ public static function getFullDayIndex(d:String):int
207
+ {
208
+ return DateBase.dayNamesLong.indexOf(d);
209
+ }
210
+
211
+ /**
212
+ * Returns a two digit representation of the year represented by the
213
+ * specified date.
214
+ *
215
+ * @param d The Date instance whose year will be used to generate a two
216
+ * digit string representation of the year.
217
+ *
218
+ * @return A string that contains a 2 digit representation of the year.
219
+ * Single digits will be padded with 0.
220
+ *
221
+ * @langversion ActionScript 3.0
222
+ * @playerversion Flash 9.0
223
+ * @tiptext
224
+ */
225
+ public static function getShortYear(d:Date):String
226
+ {
227
+ var dStr:String = String(d.getFullYear());
228
+
229
+ if(dStr.length < 3)
230
+ {
231
+ return dStr;
232
+ }
233
+
234
+ return (dStr.substr(dStr.length - 2));
235
+ }
236
+
237
+ /**
238
+ * Compares two dates and returns an integer depending on their relationship.
239
+ *
240
+ * Returns -1 if d1 is greater than d2.
241
+ * Returns 1 if d2 is greater than d1.
242
+ * Returns 0 if both dates are equal.
243
+ *
244
+ * @param d1 The date that will be compared to the second date.
245
+ * @param d2 The date that will be compared to the first date.
246
+ *
247
+ * @return An int indicating how the two dates compare.
248
+ *
249
+ * @langversion ActionScript 3.0
250
+ * @playerversion Flash 9.0
251
+ * @tiptext
252
+ */
253
+ public static function compareDates(d1:Date, d2:Date):int
254
+ {
255
+ var d1ms:Number = d1.getTime();
256
+ var d2ms:Number = d2.getTime();
257
+
258
+ if(d1ms > d2ms)
259
+ {
260
+ return -1;
261
+ }
262
+ else if(d1ms < d2ms)
263
+ {
264
+ return 1;
265
+ }
266
+ else
267
+ {
268
+ return 0;
269
+ }
270
+ }
271
+
272
+ /**
273
+ * Returns a short hour (0 - 12) represented by the specified date.
274
+ *
275
+ * If the hour is less than 12 (0 - 11 AM) then the hour will be returned.
276
+ *
277
+ * If the hour is greater than 12 (12 - 23 PM) then the hour minus 12
278
+ * will be returned.
279
+ *
280
+ * @param d1 The Date from which to generate the short hour
281
+ *
282
+ * @return An int between 0 and 13 ( 1 - 12 ) representing the short hour.
283
+ *
284
+ * @langversion ActionScript 3.0
285
+ * @playerversion Flash 9.0
286
+ * @tiptext
287
+ */
288
+ public static function getShortHour(d:Date):int
289
+ {
290
+ var h:int = d.hours;
291
+
292
+ if(h == 0 || h == 12)
293
+ {
294
+ return 12;
295
+ }
296
+ else if(h > 12)
297
+ {
298
+ return h - 12;
299
+ }
300
+ else
301
+ {
302
+ return h;
303
+ }
304
+ }
305
+
306
+ /**
307
+ * Returns a string indicating whether the date represents a time in the
308
+ * ante meridiem (AM) or post meridiem (PM).
309
+ *
310
+ * If the hour is less than 12 then "AM" will be returned.
311
+ *
312
+ * If the hour is greater than 12 then "PM" will be returned.
313
+ *
314
+ * @param d1 The Date from which to generate the 12 hour clock indicator.
315
+ *
316
+ * @return A String ("AM" or "PM") indicating which half of the day the
317
+ * hour represents.
318
+ *
319
+ * @langversion ActionScript 3.0
320
+ * @playerversion Flash 9.0
321
+ * @tiptext
322
+ */
323
+ public static function getAMPM(d:Date):String
324
+ {
325
+ return (d.hours > 11)? "PM" : "AM";
326
+ }
327
+
328
+ /**
329
+ * Parses dates that conform to RFC822 into Date objects. This method also
330
+ * supports four-digit years (not supported in RFC822), but two-digit years
331
+ * (referring to the 20th century) are fine, too.
332
+ *
333
+ * This function is useful for parsing RSS .91, .92, and 2.0 dates.
334
+ *
335
+ * @param str
336
+ *
337
+ * @returns
338
+ *
339
+ * @langversion ActionScript 3.0
340
+ * @playerversion Flash 9.0
341
+ * @tiptext
342
+ *
343
+ * @see http://asg.web.cmu.edu/rfc/rfc822.html
344
+ */
345
+ public static function parseRFC822(str:String):Date
346
+ {
347
+ var finalDate:Date;
348
+ try
349
+ {
350
+ var dateParts:Array = str.split(" ");
351
+ var day:String = null;
352
+
353
+ if (dateParts[0].search(/\d/) == -1)
354
+ {
355
+ day = dateParts.shift().replace(/\W/, "");
356
+ }
357
+
358
+ var date:Number = Number(dateParts.shift());
359
+ var month:Number = Number(DateUtil.getShortMonthIndex(dateParts.shift()));
360
+ var year:Number = Number(dateParts.shift());
361
+ var timeParts:Array = dateParts.shift().split(":");
362
+ var hour:Number = int(timeParts.shift());
363
+ var minute:Number = int(timeParts.shift());
364
+ var second:Number = (timeParts.length > 0) ? int(timeParts.shift()): 0;
365
+
366
+ var milliseconds:Number = Date.UTC(year, month, date, hour, minute, second, 0);
367
+
368
+ var timezone:String = dateParts.shift();
369
+ var offset:Number = 0;
370
+
371
+ if (timezone.search(/\d/) == -1)
372
+ {
373
+ switch(timezone)
374
+ {
375
+ case "UT":
376
+ offset = 0;
377
+ break;
378
+ case "UTC":
379
+ offset = 0;
380
+ break;
381
+ case "GMT":
382
+ offset = 0;
383
+ break;
384
+ case "EST":
385
+ offset = (-5 * 3600000);
386
+ break;
387
+ case "EDT":
388
+ offset = (-4 * 3600000);
389
+ break;
390
+ case "CST":
391
+ offset = (-6 * 3600000);
392
+ break;
393
+ case "CDT":
394
+ offset = (-5 * 3600000);
395
+ break;
396
+ case "MST":
397
+ offset = (-7 * 3600000);
398
+ break;
399
+ case "MDT":
400
+ offset = (-6 * 3600000);
401
+ break;
402
+ case "PST":
403
+ offset = (-8 * 3600000);
404
+ break;
405
+ case "PDT":
406
+ offset = (-7 * 3600000);
407
+ break;
408
+ case "Z":
409
+ offset = 0;
410
+ break;
411
+ case "A":
412
+ offset = (-1 * 3600000);
413
+ break;
414
+ case "M":
415
+ offset = (-12 * 3600000);
416
+ break;
417
+ case "N":
418
+ offset = (1 * 3600000);
419
+ break;
420
+ case "Y":
421
+ offset = (12 * 3600000);
422
+ break;
423
+ default:
424
+ offset = 0;
425
+ }
426
+ }
427
+ else
428
+ {
429
+ var multiplier:Number = 1;
430
+ var oHours:Number = 0;
431
+ var oMinutes:Number = 0;
432
+ if (timezone.length != 4)
433
+ {
434
+ if (timezone.charAt(0) == "-")
435
+ {
436
+ multiplier = -1;
437
+ }
438
+ timezone = timezone.substr(1, 4);
439
+ }
440
+ oHours = Number(timezone.substr(0, 2));
441
+ oMinutes = Number(timezone.substr(2, 2));
442
+ offset = (((oHours * 3600000) + (oMinutes * 60000)) * multiplier);
443
+ }
444
+
445
+ finalDate = new Date(milliseconds - offset);
446
+
447
+ if (finalDate.toString() == "Invalid Date")
448
+ {
449
+ throw new Error("This date does not conform to RFC822.");
450
+ }
451
+ }
452
+ catch (e:Error)
453
+ {
454
+ var eStr:String = "Unable to parse the string [" +str+ "] into a date. ";
455
+ eStr += "The internal error was: " + e.toString();
456
+ throw new Error(eStr);
457
+ }
458
+ return finalDate;
459
+ }
460
+
461
+ /**
462
+ * Returns a date string formatted according to RFC822.
463
+ *
464
+ * @param d
465
+ *
466
+ * @returns
467
+ *
468
+ * @langversion ActionScript 3.0
469
+ * @playerversion Flash 9.0
470
+ * @tiptext
471
+ *
472
+ * @see http://asg.web.cmu.edu/rfc/rfc822.html
473
+ */
474
+ public static function toRFC822(d:Date):String
475
+ {
476
+ var date:Number = d.getUTCDate();
477
+ var hours:Number = d.getUTCHours();
478
+ var minutes:Number = d.getUTCMinutes();
479
+ var seconds:Number = d.getUTCSeconds();
480
+ var sb:String = new String();
481
+ sb += DateBase.dayNamesShort[d.getUTCDay()];
482
+ sb += ", ";
483
+
484
+ if (date < 10)
485
+ {
486
+ sb += "0";
487
+ }
488
+ sb += date;
489
+ sb += " ";
490
+ //sb += DateUtil.SHORT_MONTH[d.getUTCMonth()];
491
+ sb += DateBase.monthNamesShort[d.getUTCMonth()];
492
+ sb += " ";
493
+ sb += d.getUTCFullYear();
494
+ sb += " ";
495
+ if (hours < 10)
496
+ {
497
+ sb += "0";
498
+ }
499
+ sb += hours;
500
+ sb += ":";
501
+ if (minutes < 10)
502
+ {
503
+ sb += "0";
504
+ }
505
+ sb += minutes;
506
+ sb += ":";
507
+ if (seconds < 10)
508
+ {
509
+ sb += "0";
510
+ }
511
+ sb += seconds;
512
+ sb += " GMT";
513
+ return sb;
514
+ }
515
+
516
+ /**
517
+ * Parses dates that conform to the W3C Date-time Format into Date objects.
518
+ *
519
+ * This function is useful for parsing RSS 1.0 and Atom 1.0 dates.
520
+ *
521
+ * @param str
522
+ *
523
+ * @returns
524
+ *
525
+ * @langversion ActionScript 3.0
526
+ * @playerversion Flash 9.0
527
+ * @tiptext
528
+ *
529
+ * @see http://www.w3.org/TR/NOTE-datetime
530
+ */
531
+ public static function parseW3CDTF(str:String):Date
532
+ {
533
+ var finalDate:Date;
534
+ try
535
+ {
536
+ var dateStr:String = str.substring(0, str.indexOf("T"));
537
+ var timeStr:String = str.substring(str.indexOf("T")+1, str.length);
538
+ var dateArr:Array = dateStr.split("-");
539
+ var year:Number = Number(dateArr.shift());
540
+ var month:Number = Number(dateArr.shift());
541
+ var date:Number = Number(dateArr.shift());
542
+
543
+ var multiplier:Number;
544
+ var offsetHours:Number;
545
+ var offsetMinutes:Number;
546
+ var offsetStr:String;
547
+
548
+ if (timeStr.indexOf("Z") != -1)
549
+ {
550
+ multiplier = 1;
551
+ offsetHours = 0;
552
+ offsetMinutes = 0;
553
+ timeStr = timeStr.replace("Z", "");
554
+ }
555
+ else if (timeStr.indexOf("+") != -1)
556
+ {
557
+ multiplier = 1;
558
+ offsetStr = timeStr.substring(timeStr.indexOf("+")+1, timeStr.length);
559
+ offsetHours = Number(offsetStr.substring(0, offsetStr.indexOf(":")));
560
+ offsetMinutes = Number(offsetStr.substring(offsetStr.indexOf(":")+1, offsetStr.length));
561
+ timeStr = timeStr.substring(0, timeStr.indexOf("+"));
562
+ }
563
+ else // offset is -
564
+ {
565
+ multiplier = -1;
566
+ offsetStr = timeStr.substring(timeStr.indexOf("-")+1, timeStr.length);
567
+ offsetHours = Number(offsetStr.substring(0, offsetStr.indexOf(":")));
568
+ offsetMinutes = Number(offsetStr.substring(offsetStr.indexOf(":")+1, offsetStr.length));
569
+ timeStr = timeStr.substring(0, timeStr.indexOf("-"));
570
+ }
571
+ var timeArr:Array = timeStr.split(":");
572
+ var hour:Number = Number(timeArr.shift());
573
+ var minutes:Number = Number(timeArr.shift());
574
+ var secondsArr:Array = (timeArr.length > 0) ? String(timeArr.shift()).split(".") : null;
575
+ var seconds:Number = (secondsArr != null && secondsArr.length > 0) ? Number(secondsArr.shift()) : 0;
576
+ var milliseconds:Number = (secondsArr != null && secondsArr.length > 0) ? Number(secondsArr.shift()) : 0;
577
+ var utc:Number = Date.UTC(year, month-1, date, hour, minutes, seconds, milliseconds);
578
+ var offset:Number = (((offsetHours * 3600000) + (offsetMinutes * 60000)) * multiplier);
579
+ finalDate = new Date(utc - offset);
580
+
581
+ if (finalDate.toString() == "Invalid Date")
582
+ {
583
+ throw new Error("This date does not conform to W3CDTF.");
584
+ }
585
+ }
586
+ catch (e:Error)
587
+ {
588
+ var eStr:String = "Unable to parse the string [" +str+ "] into a date. ";
589
+ eStr += "The internal error was: " + e.toString();
590
+ throw new Error(eStr);
591
+ }
592
+ return finalDate;
593
+ }
594
+
595
+ /**
596
+ * Returns a date string formatted according to W3CDTF.
597
+ *
598
+ * @param d
599
+ * @param includeMilliseconds Determines whether to include the
600
+ * milliseconds value (if any) in the formatted string.
601
+ *
602
+ * @returns
603
+ *
604
+ * @langversion ActionScript 3.0
605
+ * @playerversion Flash 9.0
606
+ * @tiptext
607
+ *
608
+ * @see http://www.w3.org/TR/NOTE-datetime
609
+ */
610
+ public static function toW3CDTF(d:Date,includeMilliseconds:Boolean=false):String
611
+ {
612
+ var date:Number = d.getUTCDate();
613
+ var month:Number = d.getUTCMonth();
614
+ var hours:Number = d.getUTCHours();
615
+ var minutes:Number = d.getUTCMinutes();
616
+ var seconds:Number = d.getUTCSeconds();
617
+ var milliseconds:Number = d.getUTCMilliseconds();
618
+ var sb:String = new String();
619
+
620
+ sb += d.getUTCFullYear();
621
+ sb += "-";
622
+
623
+ //thanks to "dom" who sent in a fix for the line below
624
+ if (month + 1 < 10)
625
+ {
626
+ sb += "0";
627
+ }
628
+ sb += month + 1;
629
+ sb += "-";
630
+ if (date < 10)
631
+ {
632
+ sb += "0";
633
+ }
634
+ sb += date;
635
+ sb += "T";
636
+ if (hours < 10)
637
+ {
638
+ sb += "0";
639
+ }
640
+ sb += hours;
641
+ sb += ":";
642
+ if (minutes < 10)
643
+ {
644
+ sb += "0";
645
+ }
646
+ sb += minutes;
647
+ sb += ":";
648
+ if (seconds < 10)
649
+ {
650
+ sb += "0";
651
+ }
652
+ sb += seconds;
653
+ if (includeMilliseconds && milliseconds > 0)
654
+ {
655
+ sb += ".";
656
+ sb += milliseconds;
657
+ }
658
+ sb += "-00:00";
659
+ return sb;
660
+ }
661
+
662
+ /**
663
+ * Converts a date into just after midnight.
664
+ */
665
+ public static function makeMorning(d:Date):Date
666
+ {
667
+ var d:Date = new Date(d.time);
668
+ d.hours = 0;
669
+ d.minutes = 0;
670
+ d.seconds = 0;
671
+ d.milliseconds = 0;
672
+ return d;
673
+ }
674
+
675
+ /**
676
+ * Converts a date into just befor midnight.
677
+ */
678
+ public static function makeNight(d:Date):Date
679
+ {
680
+ var d:Date = new Date(d.time);
681
+ d.hours = 23;
682
+ d.minutes = 59;
683
+ d.seconds = 59;
684
+ d.milliseconds = 999;
685
+ return d;
686
+ }
687
+
688
+ /**
689
+ * Sort of converts a date into UTC.
690
+ */
691
+ public static function getUTCDate(d:Date):Date
692
+ {
693
+ var nd:Date = new Date();
694
+ var offset:Number = d.getTimezoneOffset() * 60 * 1000;
695
+ nd.setTime(d.getTime() + offset);
696
+ return nd;
697
+ }
698
+ }
699
+ }
skin/frontend/base/default/uploadfile/com/adobe/utils/DictionaryUtil.as ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.utils
34
+ {
35
+ import flash.utils.Dictionary;
36
+
37
+ public class DictionaryUtil
38
+ {
39
+
40
+ /**
41
+ * Returns an Array of all keys within the specified dictionary.
42
+ *
43
+ * @param d The Dictionary instance whose keys will be returned.
44
+ *
45
+ * @return Array of keys contained within the Dictionary
46
+ *
47
+ * @langversion ActionScript 3.0
48
+ * @playerversion Flash 9.0
49
+ * @tiptext
50
+ */
51
+ public static function getKeys(d:Dictionary):Array
52
+ {
53
+ var a:Array = new Array();
54
+
55
+ for (var key:Object in d)
56
+ {
57
+ a.push(key);
58
+ }
59
+
60
+ return a;
61
+ }
62
+
63
+ /**
64
+ * Returns an Array of all values within the specified dictionary.
65
+ *
66
+ * @param d The Dictionary instance whose values will be returned.
67
+ *
68
+ * @return Array of values contained within the Dictionary
69
+ *
70
+ * @langversion ActionScript 3.0
71
+ * @playerversion Flash 9.0
72
+ * @tiptext
73
+ */
74
+ public static function getValues(d:Dictionary):Array
75
+ {
76
+ var a:Array = new Array();
77
+
78
+ for each (var value:Object in d)
79
+ {
80
+ a.push(value);
81
+ }
82
+
83
+ return a;
84
+ }
85
+
86
+ }
87
+ }
skin/frontend/base/default/uploadfile/com/adobe/utils/IntUtil.as ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+ package com.adobe.utils {
33
+
34
+ import flash.utils.Endian;
35
+
36
+ /**
37
+ * Contains reusable methods for operations pertaining
38
+ * to int values.
39
+ */
40
+ public class IntUtil {
41
+
42
+ /**
43
+ * Rotates x left n bits
44
+ *
45
+ * @langversion ActionScript 3.0
46
+ * @playerversion Flash 9.0
47
+ * @tiptext
48
+ */
49
+ public static function rol ( x:int, n:int ):int {
50
+ return ( x << n ) | ( x >>> ( 32 - n ) );
51
+ }
52
+
53
+ /**
54
+ * Rotates x right n bits
55
+ *
56
+ * @langversion ActionScript 3.0
57
+ * @playerversion Flash 9.0
58
+ * @tiptext
59
+ */
60
+ public static function ror ( x:int, n:int ):uint {
61
+ var nn:int = 32 - n;
62
+ return ( x << nn ) | ( x >>> ( 32 - nn ) );
63
+ }
64
+
65
+ /** String for quick lookup of a hex character based on index */
66
+ private static var hexChars:String = "0123456789abcdef";
67
+
68
+ /**
69
+ * Outputs the hex value of a int, allowing the developer to specify
70
+ * the endinaness in the process. Hex output is lowercase.
71
+ *
72
+ * @param n The int value to output as hex
73
+ * @param bigEndian Flag to output the int as big or little endian
74
+ * @return A string of length 8 corresponding to the
75
+ * hex representation of n ( minus the leading "0x" )
76
+ * @langversion ActionScript 3.0
77
+ * @playerversion Flash 9.0
78
+ * @tiptext
79
+ */
80
+ public static function toHex( n:int, bigEndian:Boolean = false ):String {
81
+ var s:String = "";
82
+
83
+ if ( bigEndian ) {
84
+ for ( var i:int = 0; i < 4; i++ ) {
85
+ s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF )
86
+ + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF );
87
+ }
88
+ } else {
89
+ for ( var x:int = 0; x < 4; x++ ) {
90
+ s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF )
91
+ + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF );
92
+ }
93
+ }
94
+
95
+ return s;
96
+ }
97
+ }
98
+
99
+ }
skin/frontend/base/default/uploadfile/com/adobe/utils/NumberFormatter.as ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.utils
34
+ {
35
+
36
+ /**
37
+ * Class that contains static utility methods for formatting Numbers
38
+ *
39
+ * @langversion ActionScript 3.0
40
+ * @playerversion Flash 9.0
41
+ * @tiptext
42
+ *
43
+ * @see #mx.formatters.NumberFormatter
44
+ */
45
+ public class NumberFormatter
46
+ {
47
+
48
+ /**
49
+ * Formats a number to include a leading zero if it is a single digit
50
+ * between -1 and 10.
51
+ *
52
+ * @param n The number that will be formatted
53
+ *
54
+ * @return A string with single digits between -1 and 10 padded with a
55
+ * leading zero.
56
+ *
57
+ * @langversion ActionScript 3.0
58
+ * @playerversion Flash 9.0
59
+ * @tiptext
60
+ */
61
+ public static function addLeadingZero(n:Number):String
62
+ {
63
+ var out:String = String(n);
64
+
65
+ if(n < 10 && n > -1)
66
+ {
67
+ out = "0" + out;
68
+ }
69
+
70
+ return out;
71
+ }
72
+
73
+ }
74
+ }
skin/frontend/base/default/uploadfile/com/adobe/utils/StringUtil.as ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.utils
34
+ {
35
+
36
+ /**
37
+ * Class that contains static utility methods for manipulating Strings.
38
+ *
39
+ * @langversion ActionScript 3.0
40
+ * @playerversion Flash 9.0
41
+ * @tiptext
42
+ */
43
+ public class StringUtil
44
+ {
45
+
46
+
47
+ /**
48
+ * Does a case insensitive compare or two strings and returns true if
49
+ * they are equal.
50
+ *
51
+ * @param s1 The first string to compare.
52
+ *
53
+ * @param s2 The second string to compare.
54
+ *
55
+ * @returns A boolean value indicating whether the strings' values are
56
+ * equal in a case sensitive compare.
57
+ *
58
+ * @langversion ActionScript 3.0
59
+ * @playerversion Flash 9.0
60
+ * @tiptext
61
+ */
62
+ public static function stringsAreEqual(s1:String, s2:String,
63
+ caseSensitive:Boolean):Boolean
64
+ {
65
+ if(caseSensitive)
66
+ {
67
+ return (s1 == s2);
68
+ }
69
+ else
70
+ {
71
+ return (s1.toUpperCase() == s2.toUpperCase());
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Removes whitespace from the front and the end of the specified
77
+ * string.
78
+ *
79
+ * @param input The String whose beginning and ending whitespace will
80
+ * will be removed.
81
+ *
82
+ * @returns A String with whitespace removed from the begining and end
83
+ *
84
+ * @langversion ActionScript 3.0
85
+ * @playerversion Flash 9.0
86
+ * @tiptext
87
+ */
88
+ public static function trim(input:String):String
89
+ {
90
+ return StringUtil.ltrim(StringUtil.rtrim(input));
91
+ }
92
+
93
+ /**
94
+ * Removes whitespace from the front of the specified string.
95
+ *
96
+ * @param input The String whose beginning whitespace will will be removed.
97
+ *
98
+ * @returns A String with whitespace removed from the begining
99
+ *
100
+ * @langversion ActionScript 3.0
101
+ * @playerversion Flash 9.0
102
+ * @tiptext
103
+ */
104
+ public static function ltrim(input:String):String
105
+ {
106
+ var size:Number = input.length;
107
+ for(var i:Number = 0; i < size; i++)
108
+ {
109
+ if(input.charCodeAt(i) > 32)
110
+ {
111
+ return input.substring(i);
112
+ }
113
+ }
114
+ return "";
115
+ }
116
+
117
+ /**
118
+ * Removes whitespace from the end of the specified string.
119
+ *
120
+ * @param input The String whose ending whitespace will will be removed.
121
+ *
122
+ * @returns A String with whitespace removed from the end
123
+ *
124
+ * @langversion ActionScript 3.0
125
+ * @playerversion Flash 9.0
126
+ * @tiptext
127
+ */
128
+ public static function rtrim(input:String):String
129
+ {
130
+ var size:Number = input.length;
131
+ for(var i:Number = size; i > 0; i--)
132
+ {
133
+ if(input.charCodeAt(i - 1) > 32)
134
+ {
135
+ return input.substring(0, i);
136
+ }
137
+ }
138
+
139
+ return "";
140
+ }
141
+
142
+ /**
143
+ * Determines whether the specified string begins with the spcified prefix.
144
+ *
145
+ * @param input The string that the prefix will be checked against.
146
+ *
147
+ * @param prefix The prefix that will be tested against the string.
148
+ *
149
+ * @returns True if the string starts with the prefix, false if it does not.
150
+ *
151
+ * @langversion ActionScript 3.0
152
+ * @playerversion Flash 9.0
153
+ * @tiptext
154
+ */
155
+ public static function beginsWith(input:String, prefix:String):Boolean
156
+ {
157
+ return (prefix == input.substring(0, prefix.length));
158
+ }
159
+
160
+ /**
161
+ * Determines whether the specified string ends with the spcified suffix.
162
+ *
163
+ * @param input The string that the suffic will be checked against.
164
+ *
165
+ * @param prefix The suffic that will be tested against the string.
166
+ *
167
+ * @returns True if the string ends with the suffix, false if it does not.
168
+ *
169
+ * @langversion ActionScript 3.0
170
+ * @playerversion Flash 9.0
171
+ * @tiptext
172
+ */
173
+ public static function endsWith(input:String, suffix:String):Boolean
174
+ {
175
+ return (suffix == input.substring(input.length - suffix.length));
176
+ }
177
+
178
+ /**
179
+ * Removes all instances of the remove string in the input string.
180
+ *
181
+ * @param input The string that will be checked for instances of remove
182
+ * string
183
+ *
184
+ * @param remove The string that will be removed from the input string.
185
+ *
186
+ * @returns A String with the remove string removed.
187
+ *
188
+ * @langversion ActionScript 3.0
189
+ * @playerversion Flash 9.0
190
+ * @tiptext
191
+ */
192
+ public static function remove(input:String, remove:String):String
193
+ {
194
+ return StringUtil.replace(input, remove, "");
195
+ }
196
+
197
+ /**
198
+ * Replaces all instances of the replace string in the input string
199
+ * with the replaceWith string.
200
+ *
201
+ * @param input The string that instances of replace string will be
202
+ * replaces with removeWith string.
203
+ *
204
+ * @param replace The string that will be replaced by instances of
205
+ * the replaceWith string.
206
+ *
207
+ * @param replaceWith The string that will replace instances of replace
208
+ * string.
209
+ *
210
+ * @returns A new String with the replace string replaced with the
211
+ * replaceWith string.
212
+ *
213
+ * @langversion ActionScript 3.0
214
+ * @playerversion Flash 9.0
215
+ * @tiptext
216
+ */
217
+ public static function replace(input:String, replace:String, replaceWith:String):String
218
+ {
219
+ //change to StringBuilder
220
+ var sb:String = new String();
221
+ var found:Boolean = false;
222
+
223
+ var sLen:Number = input.length;
224
+ var rLen:Number = replace.length;
225
+
226
+ for (var i:Number = 0; i < sLen; i++)
227
+ {
228
+ if(input.charAt(i) == replace.charAt(0))
229
+ {
230
+ found = true;
231
+ for(var j:Number = 0; j < rLen; j++)
232
+ {
233
+ if(!(input.charAt(i + j) == replace.charAt(j)))
234
+ {
235
+ found = false;
236
+ break;
237
+ }
238
+ }
239
+
240
+ if(found)
241
+ {
242
+ sb += replaceWith;
243
+ i = i + (rLen - 1);
244
+ continue;
245
+ }
246
+ }
247
+ sb += input.charAt(i);
248
+ }
249
+ //TODO : if the string is not found, should we return the original
250
+ //string?
251
+ return sb;
252
+ }
253
+
254
+ /**
255
+ * Specifies whether the specified string is either non-null, or contains
256
+ * characters (i.e. length is greater that 0)
257
+ *
258
+ * @param s The string which is being checked for a value
259
+ *
260
+ * @langversion ActionScript 3.0
261
+ * @playerversion Flash 9.0
262
+ * @tiptext
263
+ */
264
+ public static function stringHasValue(s:String):Boolean
265
+ {
266
+ //todo: this needs a unit test
267
+ return (s != null && s.length > 0);
268
+ }
269
+ }
270
+ }
skin/frontend/base/default/uploadfile/com/adobe/utils/XMLUtil.as ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.utils
34
+ {
35
+
36
+ public class XMLUtil
37
+ {
38
+ /**
39
+ * Constant representing a text node type returned from XML.nodeKind.
40
+ *
41
+ * @see XML.nodeKind()
42
+ *
43
+ * @langversion ActionScript 3.0
44
+ * @playerversion Flash 9.0
45
+ */
46
+ public static const TEXT:String = "text";
47
+
48
+ /**
49
+ * Constant representing a comment node type returned from XML.nodeKind.
50
+ *
51
+ * @see XML.nodeKind()
52
+ *
53
+ * @langversion ActionScript 3.0
54
+ * @playerversion Flash 9.0
55
+ */
56
+ public static const COMMENT:String = "comment";
57
+
58
+ /**
59
+ * Constant representing a processing instruction type returned from XML.nodeKind.
60
+ *
61
+ * @see XML.nodeKind()
62
+ *
63
+ * @langversion ActionScript 3.0
64
+ * @playerversion Flash 9.0
65
+ */
66
+ public static const PROCESSING_INSTRUCTION:String = "processing-instruction";
67
+
68
+ /**
69
+ * Constant representing an attribute type returned from XML.nodeKind.
70
+ *
71
+ * @see XML.nodeKind()
72
+ *
73
+ * @langversion ActionScript 3.0
74
+ * @playerversion Flash 9.0
75
+ */
76
+ public static const ATTRIBUTE:String = "attribute";
77
+
78
+ /**
79
+ * Constant representing a element type returned from XML.nodeKind.
80
+ *
81
+ * @see XML.nodeKind()
82
+ *
83
+ * @langversion ActionScript 3.0
84
+ * @playerversion Flash 9.0
85
+ */
86
+ public static const ELEMENT:String = "element";
87
+
88
+ /**
89
+ * Checks whether the specified string is valid and well formed XML.
90
+ *
91
+ * @param data The string that is being checked to see if it is valid XML.
92
+ *
93
+ * @return A Boolean value indicating whether the specified string is
94
+ * valid XML.
95
+ *
96
+ * @langversion ActionScript 3.0
97
+ * @playerversion Flash 9.0
98
+ */
99
+ public static function isValidXML(data:String):Boolean
100
+ {
101
+ var xml:XML;
102
+
103
+ try
104
+ {
105
+ xml = new XML(data);
106
+ }
107
+ catch(e:Error)
108
+ {
109
+ return false;
110
+ }
111
+
112
+ if(xml.nodeKind() != XMLUtil.ELEMENT)
113
+ {
114
+ return false;
115
+ }
116
+
117
+ return true;
118
+ }
119
+
120
+ /**
121
+ * Returns the next sibling of the specified node relative to the node's parent.
122
+ *
123
+ * @param x The node whose next sibling will be returned.
124
+ *
125
+ * @return The next sibling of the node. null if the node does not have
126
+ * a sibling after it, or if the node has no parent.
127
+ *
128
+ * @langversion ActionScript 3.0
129
+ * @playerversion Flash 9.0
130
+ */
131
+ public static function getNextSibling(x:XML):XML
132
+ {
133
+ return XMLUtil.getSiblingByIndex(x, 1);
134
+ }
135
+
136
+ /**
137
+ * Returns the sibling before the specified node relative to the node's parent.
138
+ *
139
+ * @param x The node whose sibling before it will be returned.
140
+ *
141
+ * @return The sibling before the node. null if the node does not have
142
+ * a sibling before it, or if the node has no parent.
143
+ *
144
+ * @langversion ActionScript 3.0
145
+ * @playerversion Flash 9.0
146
+ */
147
+ public static function getPreviousSibling(x:XML):XML
148
+ {
149
+ return XMLUtil.getSiblingByIndex(x, -1);
150
+ }
151
+
152
+ protected static function getSiblingByIndex(x:XML, count:int):XML
153
+ {
154
+ var out:XML;
155
+
156
+ try
157
+ {
158
+ out = x.parent().children()[x.childIndex() + count];
159
+ }
160
+ catch(e:Error)
161
+ {
162
+ return null;
163
+ }
164
+
165
+ return out;
166
+ }
167
+ }
168
+ }
skin/frontend/base/default/uploadfile/com/adobe/webapis/ServiceBase.as ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+
34
+ package com.adobe.webapis
35
+ {
36
+ import flash.events.EventDispatcher;
37
+
38
+ /**
39
+ * Base class for remote service classes.
40
+ */
41
+ public class ServiceBase extends EventDispatcher
42
+ {
43
+ public function ServiceBase()
44
+ {
45
+ }
46
+
47
+ }
48
+ }
skin/frontend/base/default/uploadfile/com/adobe/webapis/URLLoaderBase.as ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+ package com.adobe.webapis
34
+ {
35
+ import flash.events.IOErrorEvent;
36
+ import flash.events.SecurityErrorEvent;
37
+ import flash.events.ProgressEvent;
38
+
39
+ import com.adobe.net.DynamicURLLoader;
40
+
41
+ /**
42
+ * Dispatched when data is
43
+ * received as the download operation progresses.
44
+ *
45
+ * @eventType flash.events.ProgressEvent.PROGRESS
46
+ *
47
+ * @langversion ActionScript 3.0
48
+ * @playerversion Flash 9.0
49
+ */
50
+ [Event(name="progress", type="flash.events.ProgressEvent")]
51
+
52
+ /**
53
+ * Dispatched if a call to the server results in a fatal
54
+ * error that terminates the download.
55
+ *
56
+ * @eventType flash.events.IOErrorEvent.IO_ERROR
57
+ *
58
+ * @langversion ActionScript 3.0
59
+ * @playerversion Flash 9.0
60
+ */
61
+ [Event(name="ioError", type="flash.events.IOErrorEvent")]
62
+
63
+ /**
64
+ * A securityError event occurs if a call attempts to
65
+ * load data from a server outside the security sandbox.
66
+ *
67
+ * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR
68
+ *
69
+ * @langversion ActionScript 3.0
70
+ * @playerversion Flash 9.0
71
+ */
72
+ [Event(name="securityError", type="flash.events.SecurityErrorEvent")]
73
+
74
+ /**
75
+ * Base class for services that utilize URLLoader
76
+ * to communicate with remote APIs / Services.
77
+ *
78
+ * @langversion ActionScript 3.0
79
+ * @playerversion Flash 9.0
80
+ */
81
+ public class URLLoaderBase extends ServiceBase
82
+ {
83
+ protected function getURLLoader():DynamicURLLoader
84
+ {
85
+ var loader:DynamicURLLoader = new DynamicURLLoader();
86
+ loader.addEventListener("progress", onProgress);
87
+ loader.addEventListener("ioError", onIOError);
88
+ loader.addEventListener("securityError", onSecurityError);
89
+
90
+ return loader;
91
+ }
92
+
93
+ private function onIOError(event:IOErrorEvent):void
94
+ {
95
+ dispatchEvent(event);
96
+ }
97
+
98
+ private function onSecurityError(event:SecurityErrorEvent):void
99
+ {
100
+ dispatchEvent(event);
101
+ }
102
+
103
+ private function onProgress(event:ProgressEvent):void
104
+ {
105
+ dispatchEvent(event);
106
+ }
107
+ }
108
+ }
skin/frontend/base/default/uploadfile/com/adobe/webapis/events/ServiceEvent.as ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright (c) 2008, Adobe Systems Incorporated
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice,
10
+ this list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of Adobe Systems Incorporated nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ */
32
+
33
+
34
+ package com.adobe.webapis.events
35
+ {
36
+
37
+ import flash.events.Event;
38
+
39
+ /**
40
+ * Event class that contains data loaded from remote services.
41
+ *
42
+ * @author Mike Chambers
43
+ */
44
+ public class ServiceEvent extends Event
45
+ {
46
+ private var _data:Object = new Object();;
47
+
48
+ /**
49
+ * Constructor for ServiceEvent class.
50
+ *
51
+ * @param type The type of event that the instance represents.
52
+ */
53
+ public function ServiceEvent(type:String, bubbles:Boolean = false,
54
+ cancelable:Boolean=false)
55
+ {
56
+ super(type, bubbles, cancelable);
57
+ }
58
+
59
+ /**
60
+ * This object contains data loaded in response
61
+ * to remote service calls, and properties associated with that call.
62
+ */
63
+ public function get data():Object
64
+ {
65
+ return _data;
66
+ }
67
+
68
+ public function set data(d:Object):void
69
+ {
70
+ _data = d;
71
+ }
72
+
73
+
74
+ }
75
+ }
skin/frontend/base/default/uploadfile/expressInstall.swf ADDED
Binary file
skin/frontend/base/default/uploadfile/jquery-1.4.2.min.js ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery JavaScript Library v1.4.2
3
+ * http://jquery.com/
4
+ *
5
+ * Copyright 2010, John Resig
6
+ * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * http://jquery.org/license
8
+ *
9
+ * Includes Sizzle.js
10
+ * http://sizzlejs.com/
11
+ * Copyright 2010, The Dojo Foundation
12
+ * Released under the MIT, BSD, and GPL Licenses.
13
+ *
14
+ * Date: Sat Feb 13 22:33:48 2010 -0500
15
+ */
16
+ (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i?
17
+ e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r=
18
+ j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,
19
+ "&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e=
20
+ true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
21
+ Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
22
+ (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
23
+ a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
24
+ "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
25
+ function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)||
26
+ c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded",
27
+ L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype,
28
+ "isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+
29
+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
30
+ d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]===
31
+ a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&&
32
+ !c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari=
33
+ true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
34
+ var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected,
35
+ parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent=
36
+ false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n=
37
+ s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,
38
+ applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando];
39
+ else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,
40
+ a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===
41
+ w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i,
42
+ cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ",
43
+ i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ",
44
+ " ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=
45
+ this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i=
46
+ e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected=
47
+ c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");
48
+ a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g,
49
+ function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split(".");
50
+ k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a),
51
+ C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!=
52
+ null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=
53
+ e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&&
54
+ f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;
55
+ if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
56
+ fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
57
+ d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this,
58
+ "events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=
59
+ a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,
60
+ isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit=
61
+ {setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
62
+ if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",
63
+ e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,
64
+ "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a,
65
+ d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&
66
+ !a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},
67
+ toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector,
68
+ u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),
69
+ function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];
70
+ if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
71
+ e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift();
72
+ t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D||
73
+ g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[];
74
+ for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length-
75
+ 1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
76
+ CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},
77
+ relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]=
78
+ l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[];
79
+ h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},
80
+ CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m,
81
+ g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},
82
+ text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},
83
+ setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=
84
+ h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m=
85
+ m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m===
86
+ "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g,
87
+ h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition||
88
+ !h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m=
89
+ h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&&
90
+ q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>";
91
+ if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}();
92
+ (function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}:
93
+ function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/,
94
+ gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length;
95
+ c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j=
96
+ {},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a===
97
+ "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",
98
+ d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?
99
+ a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType===
100
+ 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)?
101
+ a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
102
+ c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
103
+ wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
104
+ prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
105
+ this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
106
+ return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja,
107
+ ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&
108
+ this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]||
109
+ u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length===
110
+ 1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]);
111
+ return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["",
112
+ ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e=
113
+ c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]?
114
+ c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja=
115
+ function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=
116
+ Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
117
+ "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f=
118
+ a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
119
+ a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!==
120
+ "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this},
121
+ serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
122
+ function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
123
+ global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&&
124
+ e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)?
125
+ "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache===
126
+ false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B=
127
+ false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since",
128
+ c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E||
129
+ d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x);
130
+ g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===
131
+ 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b===
132
+ "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional;
133
+ if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");
134
+ this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a],
135
+ "olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)},
136
+ animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing=
137
+ j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);
138
+ this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration===
139
+ "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||
140
+ c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;
141
+ this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=
142
+ this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,
143
+ e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
144
+ c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
145
+ function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b=
146
+ this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle;
147
+ k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&&
148
+ f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
149
+ a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b);
150
+ c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a,
151
+ d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top-
152
+ f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset":
153
+ "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in
154
+ e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window);
skin/frontend/base/default/uploadfile/jquery.uploadify.v2.1.4.js ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Uploadify v2.1.4
3
+ Release Date: November 8, 2010
4
+
5
+ Copyright (c) 2010 Ronnie Garcia, Travis Nickels
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ if(jQuery)(
27
+ function(jQuery){
28
+ jQuery.extend(jQuery.fn,{
29
+ uploadify:function(options) {
30
+ jQuery(this).each(function(){
31
+ var settings = jQuery.extend({
32
+ id : jQuery(this).attr('id'), // The ID of the object being Uploadified
33
+ uploader : 'uploadify.swf', // The path to the uploadify swf file
34
+ script : 'uploadify.php', // The path to the uploadify backend upload script
35
+ expressInstall : null, // The path to the express install swf file
36
+ folder : '', // The path to the upload folder
37
+ height : 30, // The height of the flash button
38
+ width : 120, // The width of the flash button
39
+ cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container
40
+ wmode : 'opaque', // The wmode of the flash file
41
+ scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains
42
+ fileDataName : 'Filedata', // The name of the file collection object in the backend upload script
43
+ method : 'POST', // The method for sending variables to the backend upload script
44
+ queueSizeLimit : 999, // The maximum size of the file queue
45
+ simUploadLimit : 1, // The number of simultaneous uploads allowed
46
+ queueID : false, // The optional ID of the queue container
47
+ displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item
48
+ removeCompleted : true, // Set to true if you want the queue items to be removed when a file is done uploading
49
+ onInit : function() {}, // Function to run when uploadify is initialized
50
+ onSelect : function() {}, // Function to run when a file is selected
51
+ onSelectOnce : function() {}, // Function to run once when files are added to the queue
52
+ onQueueFull : function() {}, // Function to run when the queue reaches capacity
53
+ onCheck : function() {}, // Function to run when script checks for duplicate files on the server
54
+ onCancel : function() {}, // Function to run when an item is cleared from the queue
55
+ onClearQueue : function() {}, // Function to run when the queue is manually cleared
56
+ onError : function() {}, // Function to run when an upload item returns an error
57
+ onProgress : function() {}, // Function to run each time the upload progress is updated
58
+ onComplete : function() {}, // Function to run when an upload is completed
59
+ onAllComplete : function() {} // Function to run when all uploads are completed
60
+ }, options);
61
+ jQuery(this).data('settings',settings);
62
+ var pagePath = location.pathname;
63
+ pagePath = pagePath.split('/');
64
+ pagePath.pop();
65
+ pagePath = pagePath.join('/') + '/';
66
+ var data = {};
67
+ data.uploadifyID = settings.id;
68
+ data.pagepath = pagePath;
69
+ if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg);
70
+ if (settings.buttonText) data.buttonText = escape(settings.buttonText);
71
+ if (settings.rollover) data.rollover = true;
72
+ data.script = settings.script;
73
+ data.folder = escape(settings.folder);
74
+ if (settings.scriptData) {
75
+ var scriptDataString = '';
76
+ for (var name in settings.scriptData) {
77
+ scriptDataString += '&' + name + '=' + settings.scriptData[name];
78
+ }
79
+ data.scriptData = escape(scriptDataString.substr(1));
80
+ }
81
+ data.width = settings.width;
82
+ data.height = settings.height;
83
+ data.wmode = settings.wmode;
84
+ data.method = settings.method;
85
+ data.queueSizeLimit = settings.queueSizeLimit;
86
+ data.simUploadLimit = settings.simUploadLimit;
87
+ if (settings.hideButton) data.hideButton = true;
88
+ if (settings.fileDesc) data.fileDesc = settings.fileDesc;
89
+ if (settings.fileExt) data.fileExt = settings.fileExt;
90
+ if (settings.multi) data.multi = true;
91
+ if (settings.auto) data.auto = true;
92
+ if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit;
93
+ if (settings.checkScript) data.checkScript = settings.checkScript;
94
+ if (settings.fileDataName) data.fileDataName = settings.fileDataName;
95
+ if (settings.queueID) data.queueID = settings.queueID;
96
+ if (settings.onInit() !== false) {
97
+ jQuery(this).css('display','none');
98
+ jQuery(this).after('<div id="' + jQuery(this).attr('id') + 'Uploader"></div>');
99
+ swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess},{},function(event) {
100
+ if (typeof(settings.onSWFReady) == 'function' && event.success) settings.onSWFReady();
101
+ });
102
+ if (settings.queueID == false) {
103
+ jQuery("#" + jQuery(this).attr('id') + "Uploader").after('<div id="' + jQuery(this).attr('id') + 'Queue" class="uploadifyQueue"></div>');
104
+ } else {
105
+ jQuery("#" + settings.queueID).addClass('uploadifyQueue');
106
+ }
107
+ }
108
+ if (typeof(settings.onOpen) == 'function') {
109
+ jQuery(this).bind("uploadifyOpen", settings.onOpen);
110
+ }
111
+ jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) {
112
+ if (event.data.action(event, ID, fileObj) !== false) {
113
+ var byteSize = Math.round(fileObj.size / 1024 * 100) * .01;
114
+ var suffix = 'KB';
115
+ if (byteSize > 1000) {
116
+ byteSize = Math.round(byteSize *.001 * 100) * .01;
117
+ suffix = 'MB';
118
+ }
119
+ var sizeParts = byteSize.toString().split('.');
120
+ if (sizeParts.length > 1) {
121
+ byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2);
122
+ } else {
123
+ byteSize = sizeParts[0];
124
+ }
125
+ if (fileObj.name.length > 20) {
126
+ fileName = fileObj.name.substr(0,20) + '...';
127
+ } else {
128
+ fileName = fileObj.name;
129
+ }
130
+ queue = '#' + jQuery(this).attr('id') + 'Queue';
131
+ if (event.data.queueID) {
132
+ queue = '#' + event.data.queueID;
133
+ }
134
+ jQuery(queue).append('<div id="' + jQuery(this).attr('id') + ID + '" class="uploadifyQueueItem">\
135
+ <div class="cancel">\
136
+ <a href="javascript:jQuery(\'#' + jQuery(this).attr('id') + '\').uploadifyCancel(\'' + ID + '\')"><img src="' + settings.cancelImg + '" border="0" /></a>\
137
+ </div>\
138
+ <span class="fileName">' + fileName + ' (' + byteSize + suffix + ')</span><span class="percentage"></span>\
139
+ <div class="uploadifyProgress">\
140
+ <div id="' + jQuery(this).attr('id') + ID + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div>\
141
+ </div>\
142
+ </div>');
143
+ }
144
+ });
145
+ jQuery(this).bind("uploadifySelectOnce", {'action': settings.onSelectOnce}, function(event, data) {
146
+ event.data.action(event, data);
147
+ if (settings.auto) {
148
+ if (settings.checkScript) {
149
+ jQuery(this).uploadifyUpload(null, false);
150
+ } else {
151
+ jQuery(this).uploadifyUpload(null, true);
152
+ }
153
+ }
154
+ });
155
+ jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) {
156
+ if (event.data.action(event, queueSizeLimit) !== false) {
157
+ alert('The queue is full. The max size is ' + queueSizeLimit + '.');
158
+ }
159
+ });
160
+ jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) {
161
+ var postData = new Object();
162
+ postData = fileQueueObj;
163
+ postData.folder = (folder.substr(0,1) == '/') ? folder : pagePath + folder;
164
+ if (single) {
165
+ for (var ID in fileQueueObj) {
166
+ var singleFileID = ID;
167
+ }
168
+ }
169
+ jQuery.post(checkScript, postData, function(data) {
170
+ for(var key in data) {
171
+ if (event.data.action(event, data, key) !== false) {
172
+ var replaceFile = confirm("Do you want to replace the file " + data[key] + "?");
173
+ if (!replaceFile) {
174
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key,true,true);
175
+ }
176
+ }
177
+ }
178
+ if (single) {
179
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true);
180
+ } else {
181
+ document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true);
182
+ }
183
+ }, "json");
184
+ });
185
+ jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, remove, clearFast) {
186
+ if (event.data.action(event, ID, fileObj, data, clearFast) !== false) {
187
+ if (remove) {
188
+ var fadeSpeed = (clearFast == true) ? 0 : 250;
189
+ jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() });
190
+ }
191
+ }
192
+ });
193
+ jQuery(this).bind("uploadifyClearQueue", {'action': settings.onClearQueue}, function(event, clearFast) {
194
+ var queueID = (settings.queueID) ? settings.queueID : jQuery(this).attr('id') + 'Queue';
195
+ if (clearFast) {
196
+ jQuery("#" + queueID).find('.uploadifyQueueItem').remove();
197
+ }
198
+ if (event.data.action(event, clearFast) !== false) {
199
+ jQuery("#" + queueID).find('.uploadifyQueueItem').each(function() {
200
+ var index = jQuery('.uploadifyQueueItem').index(this);
201
+ jQuery(this).delay(index * 100).fadeOut(250, function() { jQuery(this).remove() });
202
+ });
203
+ }
204
+ });
205
+ var errorArray = [];
206
+ jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) {
207
+ if (event.data.action(event, ID, fileObj, errorObj) !== false) {
208
+ var fileArray = new Array(ID, fileObj, errorObj);
209
+ errorArray.push(fileArray);
210
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(" - " + errorObj.type + " Error");
211
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.uploadifyProgress').hide();
212
+ jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError');
213
+ }
214
+ });
215
+ if (typeof(settings.onUpload) == 'function') {
216
+ jQuery(this).bind("uploadifyUpload", settings.onUpload);
217
+ }
218
+ jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) {
219
+ if (event.data.action(event, ID, fileObj, data) !== false) {
220
+ jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").animate({'width': data.percentage + '%'},250,function() {
221
+ if (data.percentage == 100) {
222
+ jQuery(this).closest('.uploadifyProgress').fadeOut(250,function() {jQuery(this).remove()});
223
+ }
224
+ });
225
+ if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';
226
+ if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';
227
+ if (event.data.toDisplay == null) displayData = ' ';
228
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(displayData);
229
+ }
230
+ });
231
+ jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) {
232
+ if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {
233
+ jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(' - Completed');
234
+ if (settings.removeCompleted) {
235
+ jQuery("#" + jQuery(event.target).attr('id') + ID).fadeOut(250,function() {jQuery(this).remove()});
236
+ }
237
+ jQuery("#" + jQuery(event.target).attr('id') + ID).addClass('completed');
238
+ }
239
+ });
240
+ if (typeof(settings.onAllComplete) == 'function') {
241
+ jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, data) {
242
+ if (event.data.action(event, data) !== false) {
243
+ errorArray = [];
244
+ }
245
+ });
246
+ }
247
+ });
248
+ },
249
+ uploadifySettings:function(settingName, settingValue, resetObject) {
250
+ var returnValue = false;
251
+ jQuery(this).each(function() {
252
+ if (settingName == 'scriptData' && settingValue != null) {
253
+ if (resetObject) {
254
+ var scriptData = settingValue;
255
+ } else {
256
+ var scriptData = jQuery.extend(jQuery(this).data('settings').scriptData, settingValue);
257
+ }
258
+ var scriptDataString = '';
259
+ for (var name in scriptData) {
260
+ scriptDataString += '&' + name + '=' + scriptData[name];
261
+ }
262
+ settingValue = escape(scriptDataString.substr(1));
263
+ }
264
+ returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue);
265
+ });
266
+ if (settingValue == null) {
267
+ if (settingName == 'scriptData') {
268
+ var returnSplit = unescape(returnValue).split('&');
269
+ var returnObj = new Object();
270
+ for (var i = 0; i < returnSplit.length; i++) {
271
+ var iSplit = returnSplit[i].split('=');
272
+ returnObj[iSplit[0]] = iSplit[1];
273
+ }
274
+ returnValue = returnObj;
275
+ }
276
+ }
277
+ return returnValue;
278
+ },
279
+ uploadifyUpload:function(ID,checkComplete) {
280
+ jQuery(this).each(function() {
281
+ if (!checkComplete) checkComplete = false;
282
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, checkComplete);
283
+ });
284
+ },
285
+ uploadifyCancel:function(ID) {
286
+ jQuery(this).each(function() {
287
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, true, false);
288
+ });
289
+ },
290
+ uploadifyClearQueue:function() {
291
+ jQuery(this).each(function() {
292
+ document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false);
293
+ });
294
+ }
295
+ })
296
+ })(jQuery);
skin/frontend/base/default/uploadfile/jquery.uploadify.v2.1.4.min.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Uploadify v2.1.4
3
+ Release Date: November 8, 2010
4
+
5
+ Copyright (c) 2010 Ronnie Garcia, Travis Nickels
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){var f=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:120,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",removeCompleted:true,onInit:function(){},onSelect:function(){},onSelectOnce:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onClearQueue:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);a(this).data("settings",f);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var g={};g.uploadifyID=f.id;g.pagepath=e;if(f.buttonImg){g.buttonImg=escape(f.buttonImg)}if(f.buttonText){g.buttonText=escape(f.buttonText)}if(f.rollover){g.rollover=true}g.script=f.script;g.folder=escape(f.folder);if(f.scriptData){var h="";for(var d in f.scriptData){h+="&"+d+"="+f.scriptData[d]}g.scriptData=escape(h.substr(1))}g.width=f.width;g.height=f.height;g.wmode=f.wmode;g.method=f.method;g.queueSizeLimit=f.queueSizeLimit;g.simUploadLimit=f.simUploadLimit;if(f.hideButton){g.hideButton=true}if(f.fileDesc){g.fileDesc=f.fileDesc}if(f.fileExt){g.fileExt=f.fileExt}if(f.multi){g.multi=true}if(f.auto){g.auto=true}if(f.sizeLimit){g.sizeLimit=f.sizeLimit}if(f.checkScript){g.checkScript=f.checkScript}if(f.fileDataName){g.fileDataName=f.fileDataName}if(f.queueID){g.queueID=f.queueID}if(f.onInit()!==false){a(this).css("display","none");a(this).after('<div id="'+a(this).attr("id")+'Uploader"></div>');swfobject.embedSWF(f.uploader,f.id+"Uploader",f.width,f.height,"9.0.24",f.expressInstall,g,{quality:"high",wmode:f.wmode,allowScriptAccess:f.scriptAccess},{},function(i){if(typeof(f.onSWFReady)=="function"&&i.success){f.onSWFReady()}});if(f.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('<div id="'+a(this).attr("id")+'Queue" class="uploadifyQueue"></div>')}else{a("#"+f.queueID).addClass("uploadifyQueue")}}if(typeof(f.onOpen)=="function"){a(this).bind("uploadifyOpen",f.onOpen)}a(this).bind("uploadifySelect",{action:f.onSelect,queueID:f.queueID},function(k,i,j){if(k.data.action(k,i,j)!==false){var l=Math.round(j.size/1024*100)*0.01;var m="KB";if(l>1000){l=Math.round(l*0.001*100)*0.01;m="MB"}var n=l.toString().split(".");if(n.length>1){l=n[0]+"."+n[1].substr(0,2)}else{l=n[0]}if(j.name.length>20){fileName=j.name.substr(0,20)+"..."}else{fileName=j.name}queue="#"+a(this).attr("id")+"Queue";if(k.data.queueID){queue="#"+k.data.queueID}a(queue).append('<div id="'+a(this).attr("id")+i+'" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#'+a(this).attr("id")+"').uploadifyCancel('"+i+'\')"><img src="'+f.cancelImg+'" border="0" /></a></div><span class="fileName">'+fileName+" ("+l+m+')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="'+a(this).attr("id")+i+'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>')}});a(this).bind("uploadifySelectOnce",{action:f.onSelectOnce},function(i,j){i.data.action(i,j);if(f.auto){if(f.checkScript){a(this).uploadifyUpload(null,false)}else{a(this).uploadifyUpload(null,true)}}});a(this).bind("uploadifyQueueFull",{action:f.onQueueFull},function(i,j){if(i.data.action(i,j)!==false){alert("The queue is full. The max size is "+j+".")}});a(this).bind("uploadifyCheckExist",{action:f.onCheck},function(n,m,l,k,p){var j=new Object();j=l;j.folder=(k.substr(0,1)=="/")?k:e+k;if(p){for(var i in l){var o=i}}a.post(m,j,function(s){for(var q in s){if(n.data.action(n,s,q)!==false){var r=confirm("Do you want to replace the file "+s[q]+"?");if(!r){document.getElementById(a(n.target).attr("id")+"Uploader").cancelFileUpload(q,true,true)}}}if(p){document.getElementById(a(n.target).attr("id")+"Uploader").startFileUpload(o,true)}else{document.getElementById(a(n.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:f.onCancel},function(n,j,m,o,i,l){if(n.data.action(n,j,m,o,l)!==false){if(i){var k=(l==true)?0:250;a("#"+a(this).attr("id")+j).fadeOut(k,function(){a(this).remove()})}}});a(this).bind("uploadifyClearQueue",{action:f.onClearQueue},function(k,j){var i=(f.queueID)?f.queueID:a(this).attr("id")+"Queue";if(j){a("#"+i).find(".uploadifyQueueItem").remove()}if(k.data.action(k,j)!==false){a("#"+i).find(".uploadifyQueueItem").each(function(){var l=a(".uploadifyQueueItem").index(this);a(this).delay(l*100).fadeOut(250,function(){a(this).remove()})})}});var c=[];a(this).bind("uploadifyError",{action:f.onError},function(m,i,l,k){if(m.data.action(m,i,l,k)!==false){var j=new Array(i,l,k);c.push(j);a("#"+a(this).attr("id")+i).find(".percentage").text(" - "+k.type+" Error");a("#"+a(this).attr("id")+i).find(".uploadifyProgress").hide();a("#"+a(this).attr("id")+i).addClass("uploadifyError")}});if(typeof(f.onUpload)=="function"){a(this).bind("uploadifyUpload",f.onUpload)}a(this).bind("uploadifyProgress",{action:f.onProgress,toDisplay:f.displayData},function(k,i,j,l){if(k.data.action(k,i,j,l)!==false){a("#"+a(this).attr("id")+i+"ProgressBar").animate({width:l.percentage+"%"},250,function(){if(l.percentage==100){a(this).closest(".uploadifyProgress").fadeOut(250,function(){a(this).remove()})}});if(k.data.toDisplay=="percentage"){displayData=" - "+l.percentage+"%"}if(k.data.toDisplay=="speed"){displayData=" - "+l.speed+"KB/s"}if(k.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+i).find(".percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:f.onComplete},function(l,i,k,j,m){if(l.data.action(l,i,k,unescape(j),m)!==false){a("#"+a(this).attr("id")+i).find(".percentage").text(" - Completed");if(f.removeCompleted){a("#"+a(l.target).attr("id")+i).fadeOut(250,function(){a(this).remove()})}a("#"+a(l.target).attr("id")+i).addClass("completed")}});if(typeof(f.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:f.onAllComplete},function(i,j){if(i.data.action(i,j)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(a(this).data("settings").scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+i[k]}j=escape(l.substr(1))}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d<b.length;d++){var h=b[d].split("=");e[h[0]]=h[1]}g=e}}return g},uploadifyUpload:function(b,c){a(this).each(function(){if(!c){c=false}document.getElementById(a(this).attr("id")+"Uploader").startFileUpload(b,c)})},uploadifyCancel:function(b){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").cancelFileUpload(b,true,true,false)})},uploadifyClearQueue:function(){a(this).each(function(){document.getElementById(a(this).attr("id")+"Uploader").clearFileUploadQueue(false)})}})})(jQuery)};
skin/frontend/base/default/uploadfile/noconflict.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery.noConflict();
skin/frontend/base/default/uploadfile/swfobject.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /* SWFObject v2.2 <http://code.google.com/p/swfobject/>
2
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
3
+ */
4
+ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
skin/frontend/base/default/uploadfile/uploadify.allglyphs.swf ADDED
Binary file
skin/frontend/base/default/uploadfile/uploadify.css ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Uploadify v2.1.4
3
+ Release Date: November 8, 2010
4
+
5
+ Copyright (c) 2010 Ronnie Garcia, Travis Nickels
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+ .uploadifyQueueItem {
26
+ background-color: #F5F5F5;
27
+ border: 2px solid #E5E5E5;
28
+ font: 11px Verdana, Geneva, sans-serif;
29
+ margin-top: 5px;
30
+ padding: 10px;
31
+ width: 350px;
32
+ }
33
+ .uploadifyError {
34
+ background-color: #FDE5DD !important;
35
+ border: 2px solid #FBCBBC !important;
36
+ }
37
+ .uploadifyQueueItem .cancel {
38
+ float: right;
39
+ }
40
+ .uploadifyQueue .completed {
41
+ background-color: #E5E5E5;
42
+ }
43
+ .uploadifyProgress {
44
+ background-color: #E5E5E5;
45
+ margin-top: 10px;
46
+ width: 100%;
47
+ }
48
+ .uploadifyProgressBar {
49
+ background-color: #0099FF;
50
+ height: 3px;
51
+ width: 1px;
52
+ }
skin/frontend/base/default/uploadfile/uploadify.fla ADDED
Binary file
skin/frontend/base/default/uploadfile/uploadify.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Uploadify v2.1.4
4
+ Release Date: November 8, 2010
5
+
6
+ Copyright (c) 2010 Ronnie Garcia, Travis Nickels
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ */
26
+ if (!empty($_FILES)) {
27
+ $tempFile = $_FILES['Filedata']['tmp_name'];
28
+ $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
29
+ $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
30
+
31
+ // $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
32
+ // $fileTypes = str_replace(';','|',$fileTypes);
33
+ // $typesArray = split('\|',$fileTypes);
34
+ // $fileParts = pathinfo($_FILES['Filedata']['name']);
35
+
36
+ // if (in_array($fileParts['extension'],$typesArray)) {
37
+ // Uncomment the following line if you want to make the directory if it doesn't exist
38
+ // mkdir(str_replace('//','/',$targetPath), 0755, true);
39
+
40
+ move_uploaded_file($tempFile,$targetFile);
41
+ echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
42
+ // } else {
43
+ // echo 'Invalid file type.';
44
+ // }
45
+ }
46
+ ?>
skin/frontend/base/default/uploadfile/uploadify.swf ADDED
Binary file