Advertisement
Guest User

Untitled

a guest
Mar 16th, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.84 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.3.0
  8. * @ Author : DeZender
  9. * @ Release on : 17.05.2011
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class FavoredMinds_Vendor_Helper_Data extends Mage_Core_Helper_Abstract {
  15. private static $_domains = array(
  16. 0 => "demo.ezeck.com",
  17. 1 => "demo2.ezeck.com",
  18. 2 => "demo2.favoredminds.com",
  19. 3 => "www.web2.smartbuzz.net",
  20. 4 => "web2.smartbuzz.net",
  21. 5 => "magento.sunrisewebtech.com",
  22. 6 => "aetur.es",
  23. 7 => "www.aetur.es",
  24. 8 => "cosasperuanas.com",
  25. 9 => "www.cosasperuanas.com",
  26. 10 => "getkooky.com",
  27. 11 => "www.getkooky.com",
  28. 12 => "test.getkooky.com",
  29. 13 => "espaceventespro.fr",
  30. 14 => "www.espaceventespro.fr",
  31. 15 => "espaceventespro.com",
  32. 16 => "www.espaceventespro.com",
  33. 17 => "bigjewelers.com",
  34. 18 => "www.bigjewelers.com",
  35. 19 => "bigjewelers.gemfindwebdesign.com",
  36. 20 => "www.alibadeal.com",
  37. 21 => "alibadeal.com",
  38. 22 => "88.183.23.73",
  39. 23 => "196.217.45.53",
  40. 24 => "www.e-tic.magentodemo.dk",
  41. 25 => "e-tic.magentodemo.dk",
  42. 26 => "e-tic.dk",
  43. 27 => "www.e-tic.dk",
  44. 28 => "purplemenu.com",
  45. 29 => "www.purplemenu.com",
  46. 30 => "cpanel11.proisp.no",
  47. 31 => "www.xn--fetemoteklr-j9a.no",
  48. 32 => "xn--fetemoteklr-j9a.no",
  49. 33 => "www.fetemoteklær.no",
  50. 34 => "fetemoteklær.no",
  51. 35 => "www.exemplarsolutions.biz",
  52. 36 => "exemplarsolutions.biz",
  53. 37 => "www.lastseason.co.nz",
  54. 38 => "lastseason.co.nz",
  55. 39 => "test.lastseason.co.nz",
  56. 40 => "miratis.com",
  57. 41 => "www.miratis.com",
  58. 42 => "miratis.co.uk",
  59. 43 => "www.miratis.co.uk",
  60. 44 => "ezeck.webnicesoft.com",
  61. 45 => "bambanoo.com",
  62. 46 => "www.bambanoo.com",
  63. 47 => "stage.bambanoo.com",
  64. 48 => "dev.bambanoo.com",
  65. 49 => "dfavors.com",
  66. 50 => "www.dfavors.com",
  67. 51 => "boutique.urbansouq.com",
  68. 52 => "www.boutique.urbansouq.com",
  69. 53 => "fishynation.com",
  70. 54 => "www.fishynation.com",
  71. 55 => "local.softprodigy.com",
  72. 56 => "202.164.43.20",
  73. 57 => "174.123.41.228",
  74. 58 => "welivealive.com",
  75. 59 => "www.welivealive.com",
  76. 60 => "208.43.226.196",
  77. 61 => "www.futureonline.com.kw",
  78. 62 => "futureonline.com.kw",
  79. 63 => "dev.futureonline.com.kw",
  80. 64 => "www.phplans.com",
  81. 65 => "phplans.com",
  82. 66 => "174.123.40.168",
  83. 67 => "markita.nl",
  84. 68 => "www.markita.nl",
  85. 69 => "dev1.markita.nl",
  86. 70 => "dename.nl",
  87. 71 => "www.dename.nl",
  88. 72 => "dename.development.cream.nl",
  89. 73 => "dename.staging.web04.cream.nl",
  90. 74 => "www.woonfabriek-online.nl",
  91. 75 => "woonfabriek-online.nl",
  92. 76 => "woonfabriek.younifydev.net",
  93. 77 => "dev.woonfabriek-online.nl",
  94. 78 => "buycheaptiresandwheels.com",
  95. 79 => "www.buycheaptiresandwheels.com",
  96. 80 => "dev.buycheaptiresandwheels.com",
  97. 81 => "area254.co.ke",
  98. 82 => "www.area254.co.ke",
  99. 83 => "10.0.12.103",
  100. 84 => "10.0.12.104",
  101. 85 => "10.0.22.103",
  102. 86 => "10.0.22.104",
  103. 87 => "10.0.32.125",
  104. 88 => "72.44.219.248",
  105. 89 => "72.44.219.253",
  106. 90 => "172.19.110.74",
  107. 91 => "172.19.110.75",
  108. 92 => "marketplace.cloudcommons.com",
  109. 93 => "qa-marketplace.cloudcommons.com",
  110. 94 => "dev-marketplace.cloudcommons.com",
  111. 95 => "www.marketplace.cloudcommons.com",
  112. 96 => "www.qa-marketplace.cloudcommons.com",
  113. 97 => "www.dev-marketplace.cloudcommons.com",
  114. 98 => "test.rtspl.info",
  115. 99 => "fourseasonscollective.com",
  116. 100 => "www.fourseasonscollective.com",
  117. 101 => "goodkmall.com",
  118. 102 => "www.goodkmall.com",
  119. 103 => "173.254.19.243",
  120. 104 => "beta-marketplace.cloudcommons.com",
  121. 105 => "50.56.38.138",
  122. 106 => "50.56.38.74",
  123. 107 => "50.56.38.75",
  124. 108 => "10.131.5.170",
  125. 109 => "10.131.5.171",
  126. 110 => "172.19.110.74",
  127. 111 => "172.19.110.75",
  128. 112 => "www.edomtom.com",
  129. 113 => "edomtom.com",
  130. 114 => "magento6.01openhosting.com",
  131. 115 => "gulfplants.com",
  132. 116 => "www.gulfplants.com",
  133. 117 => "roaringforkflies.com",
  134. 118 => "www.roaringforkflies.com",
  135. 119 => "dev.roaringforkflies.com",
  136. 120 => "beta.roaringforkflies.com",
  137. 121 => "pngtradepost.com",
  138. 122 => "www.pngtradepost.com",
  139. 123 => "chelseaexchange.com",
  140. 124 => "www.chelseaexchange.com",
  141. 125 => "213.229.86.30",
  142. 126 => "184.168.92.52",
  143. 127 => "spektrade.com",
  144. 128 => "spektrade.com",
  145. 129 => "soundsonic.com",
  146. 130 => "www.soundsonic.com",
  147. 131 => "192.168.100.16",
  148. 132 => "deftsoft.org",
  149. 133 => "www.deftsoft.org",
  150. 134 => "wonderfan.com",
  151. 135 => "www.wonderfan.com",
  152. 136 => "eshop.aldr.cz",
  153. 137 => "www.eshop.aldr.cz",
  154. 138 => "caribzon.com",
  155. 139 => "www.caribzon.com",
  156. 140 => "www.invitecottage.com",
  157. 141 => "invitecottage.com",
  158. 142 => "invite.dev01.atlanticbt.net",
  159. 143 => "shoppingby.me",
  160. 144 => "www.shoppingby.me",
  161. 145 => "dev.shoppingby.me",
  162. 146 => "purehome.com",
  163. 147 => "www.purehome.com",
  164. 148 => "ec-cam.jp",
  165. 149 => "www.ec-cam.jp",
  166. 150 => "test.ec-cam.jp",
  167. 151 => "portero.com",
  168. 152 => "www.portero.com",
  169. 153 => "portero.spicedigitalmarketing.com",
  170. 154 => "re-dazzle.com",
  171. 155 => "www.re-dazzle.com",
  172. 156 => "dev.re-dazzle.com",
  173. 157 => "redazzle.com",
  174. 158 => "www.redazzle.com",
  175. 159 => "dev.redazzle.com",
  176. 160 => "183.purplecat.net",
  177. 161 => "1000knih.sk",
  178. 162 => "www.1000knih.sk",
  179. 163 => "shopeasy.ph",
  180. 164 => "www.shopeasy.ph",
  181. 165 => "192.168.204.130",
  182. 166 => "acosolar.com",
  183. 167 => "www.acosolar.com",
  184. 168 => "184.172.146.192",
  185. 169 => "mondofood.com",
  186. 170 => "www.mondofood.com",
  187. 171 => "secretaressewinkel.nl",
  188. 172 => "www.secretaressewinkel.nl",
  189. 173 => "wow.amcservices.it",
  190. 174 => "walkonwine.com",
  191. 175 => "www.walkonwine.com",
  192. 176 => "myshop24seven.com",
  193. 177 => "www.myshop24seven.com",
  194. 178 => "local.softprodigy.com",
  195. 179 => "www.fourseasonscollective.com",
  196. 180 => "fourseasonscollective.com",
  197. 181 => "test.rtspl.info",
  198. 182 => "purecitizen.com",
  199. 183 => "www.purecitizen.com",
  200. 184 => "staging.purecitizen.com",
  201. 185 => "onme.com",
  202. 186 => "www.onme.com",
  203. 187 => "shoppywood.com",
  204. 188 => "www.shoppywood.com",
  205. 189 => "ecom.greenkogroup.com",
  206. 190 => "www.ecom.greenkogroup.com",
  207. 191 => "priceking.phpdevelopment.co.in",
  208. 192 => "priceking.in",
  209. 193 => "www.priceking.in",
  210. 194 => "provendors.com",
  211. 195 => "www.provendors.com",
  212. 196 => "www.peradora.de",
  213. 197 => "peradora.de",
  214. 198 => "projekte-web.com",
  215. 199 => "www.projekte-web.com",
  216. 200 => "bvira.com",
  217. 201 => "www.bvira.com",
  218. 202 => "weddingplace.com.au",
  219. 203 => "www.weddingplace.com.au",
  220. 204 => "115.70.134.212",
  221. 205 => "dev2011v.bvira.com",
  222. 206 => "qa2011v.bvira.com",
  223. 207 => "staging2011v.bvira.com",
  224. 208 => "extrovart.com",
  225. 209 => "www.extrovart.com",
  226. 210 => "hans-dampf.net",
  227. 211 => "www.hans-dampf.net",
  228. 212 => "dev.hans-dampf.net",
  229. 213 => "plusalia.com",
  230. 214 => "www.plusalia.com",
  231. 215 => "pingnow.com",
  232. 216 => "www.pingnow.com",
  233. 217 => "dev.pingnow.com",
  234. 218 => "cleaningworld.co.uk",
  235. 219 => "www.cleaningworld.co.uk",
  236. 220 => "ovationmusic.com",
  237. 221 => "www.ovationmusic.com",
  238. 222 => "vicino.me",
  239. 223 => "www.vicino.me",
  240. 224 => "demo.vicino.me",
  241. 225 => "efficienttrade.co.nz",
  242. 226 => "www.efficienttrade.co.nz",
  243. 227 => "ingramswaterandair.com",
  244. 228 => "www.ingramswaterandair.com",
  245. 229 => "dev.ingramswaterandair.com",
  246. 230 => "myflipcharts.com",
  247. 231 => "www.myflipcharts.com",
  248. 232 => "46.23.68.75",
  249. 233 => "cleaningworld.co.uk",
  250. 234 => "www.cleaningworld.co.uk",
  251. 235 => "tiendascom.com",
  252. 236 => "www.tiendascom.com",
  253. 237 => "dev.tiendascom.com",
  254. 238 => "v8co.com",
  255. 239 => "www.v8co.com",
  256. 240 => "test.v8co.com",
  257. 241 => "exclusivogolden.com",
  258. 242 => "www.exclusivogolden.com",
  259. 243 => "66.147.244.205",
  260. 244 => "kanaim.com.ve",
  261. 245 => "www.kanaim.com.ve",
  262. 246 => "elmostradordeutopicus.com",
  263. 247 => "www.elmostradordeutopicus.com",
  264. 248 => "tienda.utopicus.consinergia.es",
  265. 249 => "lovenature.net.tw",
  266. 250 => "www.lovenature.net.tw",
  267. 251 => "114.32.7.102",
  268. 252 => "jolinjolan.com",
  269. 253 => "www.jolinjolan.com",
  270. 254 => "glasale.com",
  271. 255 => "www.glasale.com",
  272. 256 => "glasale.magentoeasy.net",
  273. 257 => "clikandget.com",
  274. 258 => "www.clikandget.com",
  275. 259 => "therealalecompany.co.uk",
  276. 260 => "www.therealalecompany.co.uk",
  277. 261 => "dev.therealalecompany.co.uk",
  278. 262 => "websites.websmart.com",
  279. 263 => "www.websites.websmart.com",
  280. 264 => "ecm-market.de",
  281. 265 => "www.ecm-market.de",
  282. 266 => "dev.ecm-market.de",
  283. 267 => "industry-of-cool.com",
  284. 268 => "www.industry-of-cool.com",
  285. 269 => "bikecraftonline.com",
  286. 270 => "www.bikecraftonline.com",
  287. 271 => "dev.bikecraftonline.com",
  288. 272 => "puloma.com",
  289. 273 => "dev.puloma.com",
  290. 274 => "devdev.puloma.com",
  291. 275 => "botane.net",
  292. 276 => "www.botane.net",
  293. 277 => "sandbox.botane.net",
  294. 278 => "iamfair.de",
  295. 279 => "www.iamfair.de",
  296. 280 => "beta.iamfair.de",
  297. 281 => "iamfair.aegro.de",
  298. 282 => "176.28.34.131",
  299. 283 => "wefashion.com.br",
  300. 284 => "www.wefashion.com.br"
  301. );
  302.  
  303. private $_vendors = array( );
  304.  
  305. function check() {
  306. if (!in_array( $_SERVER['HTTP_HOST'], self::$_domains )) {
  307. return false;
  308. }
  309.  
  310. return true;
  311. }
  312.  
  313. function getVendor($id) {
  314. FavoredMinds_Vendor_Model_Vendor;
  315.  
  316. if ($id instanceof null) {
  317. if (empty( $this->_vendors[$id->getId( )] )) {
  318. $this->_vendors[$id->getId( )] = $id;
  319. }
  320.  
  321. return $id;
  322. }
  323.  
  324. if (empty( $this->_vendors[$id] )) {
  325. $this->_vendors[$id] = Mage::getmodel( 'vendor/vendor' )->load( $id );
  326. }
  327.  
  328. return $this->_vendors[$id];
  329. }
  330.  
  331. function sendVendorMail($vendor_id, $mail_data, &$order) {
  332. $helper = Mage::app( )->getHelper( 'vendor' );
  333. $vendor_data = $this->getVendorUserInfo( $vendor_id );
  334. $translate = Mage::getsingleton( 'core/translate' );
  335. $translate->setTranslateInline( false );
  336. $mailTemplate = Mage::getmodel( 'core/email_template' );
  337. $content = new Mage_Core_Block_Template( );
  338. $paymentBlock = Mage::helper( 'payment' )->getInfoBlock( $order->getPayment( ) )->setIsSecureMode( true );
  339. $paymentBlock->getMethod( )->setStore( $order->getStore( )->getId( ) );
  340.  
  341. if (Mage::registry( 'vendor_data' )) {
  342. Mage::unregister( 'vendor_data' );
  343. }
  344.  
  345. Mage::register( 'vendor_data', $vendor_data );
  346.  
  347. if (Mage::registry( 'mail_data' )) {
  348. Mage::unregister( 'mail_data' );
  349. }
  350.  
  351. Mage::register( 'mail_data', $mail_data );
  352. $mailTemplate->setDesignConfig( array( 'area' => 'frontend' ) )->sendTransactional( Mage::getstoreconfig( 'vendor/email/newordertemplate' ), array( 'name' => Mage::getstoreconfig( 'vendor/email/sendername' ), 'email' => Mage::getstoreconfig( 'vendor/email/senderaddress' ) ), $vendor_data['email'], $vendor_data['company_name'], array( 'vendorData' => $vendor_data, 'order' => $order, 'company_name' => $vendor_data['company_name'], 'mailData' => $mail_data, 'billing' => $order->getBillingAddress( ), 'payment_html' => $paymentBlock->toHtml( ) ) );
  353. return $mailTemplate->getSentSuccess( );
  354. }
  355.  
  356. function isVendorRoleInstalled() {
  357. return (0 < $this->getVendorRoleId( ) * 1 ? true : false);
  358. }
  359.  
  360. function getVendorRoleId() {
  361. $return = false;
  362. $write = Mage::getsingleton( 'core/resource' )->getConnection( 'core_write' );
  363. $table = $this->getTableName( 'admin_role' );
  364. $result = $write->query( '' . 'select * from `' . $table . '` where `role_name`=\'Vendor\';' );
  365. $line = $result->fetch( );
  366.  
  367. if (( isset( $line['role_id'] ) && 0 < $line['role_id'] * 1 )) {
  368. $return = $line['role_id'];
  369. }
  370.  
  371. return $return;
  372. }
  373.  
  374. function vendorIsLogged() {
  375. $return = false;
  376. $vendor_id = $this->getVendorUserId( );
  377.  
  378. if (!empty( $vendor_id )) {
  379. $return = ($this->isVendorCoreUser( $vendor_id ) == true ? true : false);
  380. }
  381.  
  382. return $return;
  383. }
  384.  
  385. function getVendorUserId() {
  386. $return = false;
  387. $write = Mage::getsingleton( 'core/resource' )->getConnection( 'core_write' );
  388. $user = Mage::getsingleton( 'admin/session' )->getUser( );
  389.  
  390. if (!empty( $user )) {
  391. $userdata = $user->toArray( );
  392. $table = $this->getTableName( 'vendors' );
  393. $result = $write->query( '' . 'select * from `' . $table . '` where `username`=\'' . $userdata['username'] . '\';' );
  394. $line = $result->fetch( );
  395. $vendor_id = $line['vendor_id'];
  396. $return = $vendor_id;
  397. }
  398.  
  399. return $return;
  400. }
  401.  
  402. function getVendorByManufacturer($manufacturer) {
  403. $write = Mage::getsingleton( 'core/resource' )->getConnection( 'core_write' );
  404. $table = $this->getTableName( 'vendors' );
  405. $result = $write->query( '' . 'select * from `' . $table . '` where `company_name`=\'' . $manufacturer . '\';' );
  406. $line = $result->fetch( );
  407.  
  408. if (( ( isset( $line['vendor_id'] ) && is_numeric( $line['vendor_id'] ) ) && 0 < $line['vendor_id'] * 1 )) {
  409. return $line['vendor_id'];
  410. }
  411.  
  412. return false;
  413. }
  414.  
  415. function getVendorProducts($vendor_id) {
  416. $manufacturer = $this->getManufacturerOption( $vendor_id );
  417. $collection = Mage::getresourcemodel( 'catalog/product_collection' )->load( );
  418. $products = array( );
  419.  
  420. foreach ($collection->getItems( ) as $_product) {
  421. $_product = Mage::getmodel( 'catalog/product' )->load( $_product->getId( ) );
  422.  
  423. if ($_product->getData( 'manufacturer' ) == $manufacturer['value']) {
  424. array_push( $products, $_product );
  425. continue;
  426. }
  427. }
  428.  
  429. return $products;
  430. }
  431.  
  432. function getManufacturers() {
  433. return $this->getAttributeOptions( 'manufacturer' );
  434. }
  435. ...........................................
  436. ...........................
  437. ..............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement