/**
  * 
  * @param type $entityId
  * @param type $profileData
  * @return type
  */
 public function loginRadiusSocialLinking($entityId, $profileData)
 {
     $session = Mage::getSingleton('customer/session');
     $redirectionLink = 'customer/account';
     $activationBlockObj = Mage::getBlockSingleton('activation/activation');
     $socialLoginLinkData = array();
     $socialLoginLinkData['sociallogin_id'] = $profileData->ID;
     $socialLoginLinkData['entity_id'] = $entityId;
     $socialLoginLinkData['provider'] = $profileData->Provider;
     $socialLoginLinkData['avatar'] = $this->socialLoginFilterAvatar($socialLoginLinkData['sociallogin_id'], $profileData->ThumbnailImageUrl, $socialLoginLinkData['provider']);
     $socialLoginLinkData['uid'] = isset($profileData->Uid) ? $profileData->Uid : '';
     $socialLoginLinkData['status'] = 'unblocked';
     if ($activationBlockObj->raasEnable() == 1) {
         if ($this->loginRadiusRead("lr_sociallogin", "provider exists in sociallogin", array($entityId, $socialLoginLinkData['provider']))) {
             $redirectionLink .= '?LoginRadiusLinked=0';
         } else {
             $customerEntity['uid'] = Mage::getSingleton("customer/session")->getLoginRadiusUid();
             if (isset($customerEntity['uid']) && !empty($customerEntity['uid'])) {
                 require_once Mage::getModuleDir('', 'Loginradius_Sociallogin') . DS . 'Helper' . DS . 'SDKClient.php';
                 global $apiClient_class;
                 $apiClient_class = 'Loginradius_Sociallogin_Helper_SDKClient';
                 $activationBlockObj = Mage::getBlockSingleton('activation/activation');
                 $accountAPI = new LoginRadiusSDK\CustomerRegistration\AccountAPI($activationBlockObj->apiKey(), $activationBlockObj->apiSecret(), array('output_format' => 'json'));
                 $innerJoinQuery = $this->getCustomerData(array('customer_entity', 'lr_sociallogin'), array($socialLoginLinkData['sociallogin_id']), 'id');
                 if ($innerJoinQuery->fetch()) {
                     Mage::getSingleton('core/session')->addError('Account already exists or linked with another account.');
                 } else {
                     try {
                         $response = $accountAPI->accountLink($customerEntity['uid'], $socialLoginLinkData['sociallogin_id'], $socialLoginLinkData['provider']);
                         if (isset($response->isPosted) && $response->isPosted == true) {
                             $this->SocialLoginInsert("lr_sociallogin", $socialLoginLinkData);
                             $session->addSuccess(__('Account linked successfully.'));
                         } else {
                             $session->addError(__('An Error here'));
                         }
                     } catch (\LoginRadiusSDK\LoginRadiusException $e) {
                         $session->addError($e->getErrorResponse()->description);
                     }
                 }
             }
         }
     } else {
         // check if any account from this provider is already linked
         $existAccount = $this->getCustomerData(array('customer_entity', 'lr_sociallogin'), array($socialLoginLinkData['sociallogin_id']), 'id');
         if (is_array($existAccount->fetch())) {
             $session->addError(__('This accounts is already linked with an account.'));
         } elseif ($this->loginRadiusRead("lr_sociallogin", "provider exists in sociallogin", array($entityId, $socialLoginLinkData['provider']))) {
             $session->addError(__('Multiple accounts cannot be linked from the same Social ID Provider.'));
         } else {
             $this->SocialLoginInsert("lr_sociallogin", $socialLoginLinkData);
             $session->addSuccess(__('Account linked successfully.'));
         }
     }
     Mage::app()->getResponse()->setRedirect(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . $redirectionLink);
     return;
 }
 public function fetchView($fileName)
 {
     //ignores file name, just uses a simple include with template name
     $path = Mage::getModuleDir('', 'Alanstormdotcom_Developermanual');
     $this->setScriptPath($path . '/templates');
     return parent::fetchView($this->getTemplate());
 }
Example #3
0
 public function getCssOutput()
 {
     $args = explode('::', $this->getCss());
     $file = Mage::getModuleDir('', $args[0]) . '/view/frontend/web/' . $args[1];
     $url = str_replace(Mage::getBaseDir(), rtrim(Mage::getBaseUrl(), '/'), $file);
     return sprintf('<link rel="stylesheet" href="%s"/>', $url);
 }
Example #4
0
 protected function _toHtml()
 {
     if (is_link(dirname(Mage::getModuleDir('', 'PostcodeNl_Api'))) && !Mage::getStoreConfig('dev/template/allow_symlink')) {
         throw new Mage_Core_Exception('Postcode.nl API Development: Symlinks not enabled! (set at Admin->System->Configuration->Advanced->Developer->Template Settings)');
     }
     return parent::_toHtml();
 }
Example #5
0
 /**
  * stub import
  * @return Xcom_Stub_Model_Updater
  */
 public function loadStub()
 {
     $dirPath = Mage::getModuleDir('etc', 'Xcom_Stub');
     $filePath = $dirPath . DS . 'stub.txt';
     $file = fopen($filePath, 'rb');
     $stub = Mage::getModel('xcom_stub/message');
     try {
         $stub->getResource()->clearStubTable();
         if (filesize($filePath)) {
             $data = unserialize(fread($file, filesize($filePath)));
             foreach ($data as $row) {
                 unset($row[$stub->getIdFieldName()]);
                 foreach ($row as $key => $value) {
                     $stub->setData($key, $value);
                 }
                 $stub->save();
                 $stub->unsetData();
             }
         }
         fclose($file);
     } catch (Exception $e) {
         fclose($file);
         Mage::throwException($e->getMessage());
     }
     return $this;
 }
 public function toOptionArray($exclude = true)
 {
     $result = array();
     $result['Magento'] = array('label' => 'Magento');
     $path = Mage::getModuleDir('', 'Mirasvit_SearchIndex') . DS . 'Model' . DS . 'Index';
     $io = new Varien_Io_File();
     $io->open();
     $io->cd($path);
     foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $space) {
         $io->cd($space['id']);
         foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $module) {
             $io->cd($module['id']);
             foreach ($io->ls(Varien_Io_File::GREP_DIRS) as $entity) {
                 if ($io->fileExists($entity['id'] . DS . 'Index.php', true)) {
                     $indexCode = $space['text'] . '_' . $module['text'] . '_' . $entity['text'];
                     $index = Mage::helper('searchindex/index')->getIndexModel($indexCode);
                     if (is_object($index)) {
                         if ($index->canUse()) {
                             if (!isset($result[$index->getBaseGroup()])) {
                                 $result[$index->getBaseGroup()] = array('label' => $index->getBaseGroup(), 'value' => array());
                             }
                             $result[$index->getBaseGroup()]['value'][] = array('value' => $index->getCode(), 'label' => $index->getBaseTitle());
                         }
                     } else {
                         Mage::throwException('Wrong model for index ' . $indexCode);
                     }
                 }
             }
         }
     }
     return $result;
 }
 protected function _loadUpdateFileFromRequest()
 {
     $path_update = Mage::getModuleDir('', 'Nofrills_Booklayout') . DS . 'content-updates' . DS . $this->getFullActionName() . '.xml';
     /*@davidselo: as� es como funciona el handle asociado al controlados que est� saltando
      * en Magento pondriamos en el layour <nofrill_reference_fox>
      * Module Name: nofrills booklayout
      * Controller Name: reference
      * Action Name: fox
      * Es esencial para itentificar unicamente cualquier petici�n basandose en estos tres criterios.
      * */
     $layout = Mage::getSingleton('core/layout')->getUpdate()->addUpdate(file_get_contents($path_update));
     //var_dump($layout);
     /*PANTALLA:
      * <block type="nofrills_booklayout/template" name="root" template="simple-page/2col.phtml" output="toHtml">
      * 		<block type="nofrills_booklayout/template" name="additional_head" template="simple-page/head.phtml" />
      * 		<block type="nofrills_booklayout/template" name="sidebar">
      * 			<action method="setTemplate"><template>simple-page/sidebar.phtml</template></action>
      * 		</block>
      * 		<block type="core/text_list" name="content" />
      * 	</block>
      * <reference name="content">
      * 		<block type="core/text" name="our_message">
      * 			<action method="setText"><text>
      * 				Magento is a foxy system.
      * 			</text></action>
      * 		</block>
      * 	</reference>	
      * <remove name="sidebar" />"
      * 
      * */
 }
Example #8
0
 /**
  * This method loads all available test suites for PHPUnit
  *
  * @return PHPUnit_Framework_TestSuite
  */
 public static function suite()
 {
     $groups = Mage::getConfig()->getNode(self::XML_PATH_UNIT_TEST_GROUPS);
     $modules = Mage::getConfig()->getNode(self::XML_PATH_UNIT_TEST_MODULES);
     $testSuiteClass = EcomDev_Utils_Reflection::getReflection((string) Mage::getConfig()->getNode(self::XML_PATH_UNIT_TEST_SUITE));
     if (!$testSuiteClass->isSubclassOf('EcomDev_PHPUnit_Test_Suite_Group')) {
         new RuntimeException('Test Suite class should be extended from EcomDev_PHPUnit_Test_Suite_Group');
     }
     $suite = new self('Magento Test Suite');
     // Walk through different groups in modules for finding test cases
     foreach ($groups->children() as $group) {
         foreach ($modules->children() as $module) {
             $realModule = Mage::getConfig()->getNode('modules/' . $module->getName());
             if (!$realModule || !$realModule->is('active')) {
                 $suite->addTest(self::warning('There is no module with name: ' . $module->getName()));
                 continue;
             }
             $moduleCodeDir = Mage::getBaseDir('code') . DS . (string) $realModule->codePool;
             $searchPath = Mage::getModuleDir('', $module->getName()) . DS . 'Test' . DS . (string) $group;
             if (!is_dir($searchPath)) {
                 continue;
             }
             $currentGroups = array($group->getName(), $module->getName());
             $testCases = self::_loadTestCases($searchPath, $moduleCodeDir);
             foreach ($testCases as $className) {
                 $suite->addTest($testSuiteClass->newInstance($className, $currentGroups));
             }
         }
     }
     if (!$suite->count()) {
         $suite->addTest(self::warning('There were no test cases for the current run'));
     }
     return $suite;
 }
 /**
  * @param $module
  * @return Mage_Core_Model_Config_Base
  */
 protected function _getModuleConfig($module)
 {
     /** @var $moduleConfig Mage_Core_Model_Config_Base */
     $moduleConfig = Mage::getModel('core/config_base');
     $moduleConfig->loadFile(Mage::getModuleDir('etc', $module) . DS . 'config.xml');
     return $moduleConfig;
 }
Example #10
0
 /**
  * Extend extra configs from etc folder of module on system init configs
  *
  * @param Varien_Event_Observer $observer
  */
 public function extendConfig($observer)
 {
     $storeCode = Mage::helper("jmbasetheme")->getCurrentStoreCode("backend");
     $profiles = array_keys(Mage::helper("jmbasetheme")->getProfiles($storeCode));
     $mergeObject = new Mage_Core_Model_Config_Base();
     $profilePath = Mage::helper("jmbasetheme")->getProfilePath($storeCode);
     foreach ($profiles as $profile) {
         if (file_exists($profilePath . "core" . DS . $profile . ".xml")) {
             $mergeObject->loadFile($profilePath . "core" . DS . $profile . ".xml");
         } else {
             $mergeObject->loadFile($profilePath . "local" . DS . $profile . ".xml");
         }
         $observer->config->extend($mergeObject, false);
     }
     if (file_exists($profilePath . "core" . DS . "core.xml")) {
         $mergeObject->loadFile($profilePath . "core" . DS . "core.xml");
         $observer->config->extend($mergeObject, false);
     }
     //extend tablet settings
     $mergeObject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/device.xml");
     $observer->config->extend($mergeObject, false);
     //extend mobile settings
     $mergeObject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/mobile.xml");
     $observer->config->extend($mergeObject, false);
 }
 /**
  * Submit new review action
  *
  */
 public function postAction()
 {
     if (Mage::getStoreConfigFlag(self::XML_PATH_PRC_ENABLED)) {
         try {
             $post = $this->getRequest()->getPost();
             if ($post) {
                 //include reCaptcha library
                 require_once Mage::getModuleDir('', 'OlegKoval_ProductReviewCaptcha') . DS . 'Helper' . DS . 'recaptchalib.php';
                 //validate captcha
                 $privatekey = Mage::getStoreConfig(self::XML_PATH_PRC_PRIVATE_KEY);
                 $remote_addr = $this->getRequest()->getServer('REMOTE_ADDR');
                 $captcha = recaptcha_check_answer($privatekey, $remote_addr, $post["recaptcha_challenge_field"], $post["recaptcha_response_field"]);
                 if (!$captcha->is_valid) {
                     throw new Exception($this->__("The reCAPTCHA wasn't entered correctly."), 1);
                 }
             } else {
                 throw new Exception('', 1);
             }
         } catch (Exception $e) {
             if (strlen($e->getMessage()) > 0) {
                 Mage::getSingleton('core/session')->addError($this->__($e->getMessage()));
                 Mage::getSingleton('core/session')->setFormData($post);
             }
             if ($redirectUrl = Mage::getSingleton('review/session')->getRedirectUrl(true)) {
                 $this->_redirectUrl($redirectUrl);
                 return;
             }
             $this->_redirectReferer();
             return;
         }
     }
     //everything is OK - call parent action
     parent::postAction();
 }
 function __construct($params)
 {
     $baseURL = isset($params['enderecoBase']) ? $params['enderecoBase'] : "https://qasecommerce.cielo.com.br";
     $certificatePath = isset($params['caminhoCertificado']) && $params['caminhoCertificado'] != "" ? $params['caminhoCertificado'] : Mage::getModuleDir('', 'Maxima_Cielo') . "/ssl/VeriSignClass3PublicPrimaryCertificationAuthority-G5.crt";
     $this->_webServiceURL = $baseURL . "/servicos/ecommwsec.do";
     $this->_SSLCertificatePath = $certificatePath;
 }
 public function fetchView($fileName)
 {
     //ignores file name, just uses a simple include with template name
     $path = Mage::getModuleDir('', 'Richardma_Exportorder');
     $this->setScriptPath($path . '/templates');
     return parent::fetchView($this->getTemplate());
 }
 protected function createHtaccesFile()
 {
     $srcFile = Mage::getModuleDir(null, 'Extendware_EWCore') . DS . 'resources' . DS . '.htaccess.template';
     $destFile = $this->getCacheDirectory() . DS . '.htaccess';
     if (@filemtime($srcFile) > @filemtime($destFile)) {
         @copy($srcFile, $destFile);
     }
 }
 /**
  * Get a path to a common model fixture file
  *
  * @param string $fixture Fixture filename
  * @return string
  */
 protected function _getSpecificFixturePath($fixture = 'test_attributes.xml')
 {
     $class = str_replace('Aoe_AttributeConfigurator_', '', get_class($this));
     $path = explode('_', $class);
     array_unshift($path, Mage::getModuleDir('', 'Aoe_AttributeConfigurator'));
     array_push($path, 'fixtures', $fixture);
     return implode(DS, $path);
 }
Example #16
0
 public function getWsdlPath()
 {
     $wsdlBasePath = Mage::getModuleDir('etc', 'Aramex_Shipment') . DS . 'wsdl' . DS . 'Aramex' . DS;
     if (Mage::getStoreConfig('aramexsettings/config/sandbox_flag') == 1) {
         $wsdlBasePath .= 'TestMode' . DS;
     }
     return $wsdlBasePath;
 }
Example #17
0
 function __construct($params)
 {
     $baseURL = Mage::getStoreConfig('payment/Maxima_Cielo_Cc/environment');
     Mage::log($baseURL);
     $certificatePath = isset($params['caminhoCertificado']) && $params['caminhoCertificado'] != "" ? $params['caminhoCertificado'] : Mage::getModuleDir('', 'Maxima_Cielo') . "/ssl/VeriSignClass3PublicPrimaryCertificationAuthority-G5.crt";
     $this->_webServiceURL = $baseURL . "/servicos/ecommwsec.do";
     Mage::log('URL: ' . $this->_webServiceURL);
     $this->_SSLCertificatePath = $certificatePath;
 }
 /**
  * Check to see if module is enabled and if we have a valid license file
  * @return bool
  */
 public function isEnabled($store_id = null)
 {
     $on = $this->getConfigVar('is_turned_on', $store_id);
     $license = file_exists(Mage::getModuleDir('etc', 'RocketWeb_GoogleBaseFeedGenerator') . '/license.txt');
     if (!$license) {
         $license = file_exists($this->_getMainLicenseFilePath());
     }
     return (bool) ($on && $license);
 }
Example #19
0
 public function __construct($arg)
 {
     list($sourceData, $moduleName) = $arg;
     parent::__construct($sourceData);
     $this->_config = Mage::getConfig();
     $this->_moduleName = $moduleName;
     $this->_moduleDir = realpath(Mage::getModuleDir('', $moduleName));
     $this->_etcModuleDir = realpath(Mage::getModuleDir('etc', $moduleName));
 }
Example #20
0
 public function __construct()
 {
     parent::__construct();
     $wsdlBasePath = Mage::getModuleDir('etc', 'Webshopapps_Endicia') . DS . 'wsdl' . DS . 'Endicia' . DS;
     $this->_prodRateLabelServiceWsdl = $wsdlBasePath . 'EwsLabelService.wsdl';
     $this->_prodTrackServiceWsdl = $wsdlBasePath . 'ELSTrackServices.wsdl';
     $this->_devRateLabelServiceWsdl = $wsdlBasePath . 'EwsLabelService.wsdl';
     $this->_devTrackServiceWsdl = $wsdlBasePath . 'ELSTrackServices.wsdl';
 }
 public function getTransport($storeId)
 {
     $_helper = Mage::helper('smtppro');
     /* @var $_helper Aschroder_SMTPPro_Helper_Data */
     $_helper->log("Getting Amazon SES Transport");
     $path = Mage::getModuleDir('', 'Aschroder_SMTPPro');
     include_once $path . '/lib/AmazonSES.php';
     $emailTransport = new App_Mail_Transport_AmazonSES(array('accessKey' => $_helper->getAmazonSESAccessKey($storeId), 'privateKey' => $_helper->getAmazonSESPrivateKey($storeId)), 'https://email.' . $_helper->getAmazonSESRegion($storeId) . '.amazonaws.com');
     return $emailTransport;
 }
 public function install()
 {
     $sqldir = Mage::getModuleDir('sql', 'Ves_Megamenu');
     $sqldir = $sqldir . DS . "ves_megamenu_setup" . DS;
     $files = glob($sqldir . '*');
     foreach ($files as $dir) {
         if (preg_match("#.php#", $dir)) {
             include $dir;
         }
     }
 }
Example #23
0
 protected static function createHtaccessFile()
 {
     $cacheDirectory = self::getCacheMediaDir();
     $destFile = $cacheDirectory . DS . '.htaccess';
     if (is_file($destFile) === false or self::$checkFilemtime === true) {
         $srcFile = Mage::getModuleDir('', 'Extendware_EWImageOpt') . DS . 'resources' . DS . '.htaccess.template';
         if (@filemtime($srcFile) > @filemtime($destFile)) {
             @copy($srcFile, $destFile);
         }
     }
 }
Example #24
0
 /**
  * Validate script path
  *
  * @param   string $scriptPath
  * @return  boolean
  */
 protected function _checkValidScriptPath($scriptPath)
 {
     $paths = array(Mage::getBaseDir('design'), Mage::getModuleDir('', 'Ash_Devbar'));
     $valid = false;
     foreach ($paths as $path) {
         if (strpos($scriptPath, realpath($path)) === 0 || $this->_getAllowSymlinks()) {
             $valid = true;
         }
     }
     return $valid;
 }
 public function getThemeConfig($theme_name)
 {
     self::$configuration_file_path = Mage::getModuleDir('etc', 'Meigee_' . $theme_name) . DS . self::CONFIGURATION_FILENAME;
     $xml = false;
     if (file_exists(self::$configuration_file_path)) {
         //parent::__construct(self::$configuration_file_path);
         $xml = simplexml_load_file(self::$configuration_file_path, 'SimpleXMLElement', LIBXML_NOCDATA);
     }
     return $xml;
     //return  $this->getNode();
 }
Example #26
0
 /**
  * Validate script path
  *
  * @param   string $scriptPath
  * @return  boolean
  */
 protected function _checkValidScriptPath($scriptPath)
 {
     $paths = array(Mage::getBaseDir('design'), Mage::getModuleDir('', 'Pan_JewelryDesigner'));
     $valid = false;
     foreach ($paths as $path) {
         if (strpos($scriptPath, realpath($path)) === 0) {
             $valid = true;
         }
     }
     return $valid;
 }
Example #27
0
 public function getControllerFileName($controller)
 {
     $parts = explode('_', self::REAL_MODULE);
     $realModule = implode('_', array_splice($parts, 0, 2));
     $file = Mage::getModuleDir('controllers', $realModule);
     if (count($parts)) {
         $file .= DS . implode(DS, $parts);
     }
     $file .= DS . uc_words($controller, DS) . 'Controller.php';
     return $file;
 }
 public function getTransport($storeId)
 {
     $_helper = Mage::helper('smtppro');
     $_helper->log("Getting Amazon SES Transport");
     $path = Mage::getModuleDir('', 'Aschroder_SMTPPro');
     include_once $path . '/lib/AmazonSES.php';
     $emailTransport = new App_Mail_Transport_AmazonSES(array('accessKey' => $_helper->getAmazonSESAccessKey($storeId), 'privateKey' => $_helper->getAmazonSESPrivateKey($storeId)));
     return $emailTransport;
 }
Example #29
-1
 public function __construct()
 {
     $OAuthStorePath = Mage::getModuleDir('', 'Yotpo_Yotpo') . DS . 'lib' . DS . 'oauth-php' . DS . 'library' . DS . 'OAuthStore.php';
     $OAuthRequesterPath = Mage::getModuleDir('', 'Yotpo_Yotpo') . DS . 'lib' . DS . 'oauth-php' . DS . 'library' . DS . 'OAuthRequester.php';
     require_once $OAuthStorePath;
     require_once $OAuthRequesterPath;
     $this->app_key = Mage::getStoreConfig('yotpo/yotpo_general_group/yotpo_appkey', Mage::app()->getStore());
     $this->secret = Mage::getStoreConfig('yotpo/yotpo_general_group/yotpo_secret', Mage::app()->getStore());
 }
 public function getThemeGuide($theme_name)
 {
     $file_path = Mage::getModuleDir('etc', 'Meigee_' . $theme_name) . DS . self::CONFIGURATION_FILENAME;
     $xml = false;
     if (file_exists($file_path)) {
         $xml = simplexml_load_file($file_path, 'SimpleXMLElement', LIBXML_NOCDATA);
     }
     return $xml;
 }