Overview

Namespaces

  • None
  • PHP

Classes

  • Eabi_DpdEE_Block_Adminhtml_Config_Form_Field_Country
  • Eabi_DpdEE_Block_Info_Payment
  • Eabi_DpdEE_Block_Invoice
  • Eabi_DpdEE_Block_Order_Courier
  • Eabi_DpdEE_Helper_Data
  • Eabi_DpdEE_Model_Api
  • Eabi_DpdEE_Model_Button_Courier
  • Eabi_DpdEE_Model_Config
  • Eabi_DpdEE_Model_Flat
  • Eabi_DpdEE_Model_Observer
  • Eabi_DpdEE_Model_Payment_Processor
  • Eabi_DpdEE_Model_Post
  • Eabi_DpdEE_Model_Source_Label_Position
  • Eabi_DpdEE_Model_Source_Service
  • Eabi_Livehandler_Adminhtml_LivehandlerController
  • Eabi_Livehandler_Adminhtml_RemoveController
  • Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Button
  • Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Remove
  • Eabi_Livehandler_Block_Email
  • Eabi_LiveHandler_Block_Footer
  • Eabi_Livehandler_Helper_Data
  • Eabi_Livehandler_Helper_Keypair
  • Eabi_Livehandler_IndexController
  • Eabi_Livehandler_Model_Abstract
  • Eabi_Livehandler_Model_Action_Abstract
  • Eabi_Livehandler_Model_Action_Postoffice_Print
  • Eabi_Livehandler_Model_Action_Postoffice_Send
  • Eabi_Livehandler_Model_Adminhtml_Gridmanager
  • Eabi_Livehandler_Model_Directory_Collection
  • Eabi_Livehandler_Model_Entry
  • Eabi_Livehandler_Model_File_Object
  • Eabi_Livehandler_Model_Mysql4_Entry
  • Eabi_Livehandler_Model_Mysql4_Entry_Collection
  • Eabi_Livehandler_Model_Ordergrid
  • Eabi_Livehandler_Model_System_Config_Backend_Button
  • Eabi_Postoffice_Adminhtml_PostofficeController
  • Eabi_Postoffice_Block_Adminhtml_Config_Form_Field_License
  • Eabi_Postoffice_Block_Adminhtml_Config_Form_Field_Remove
  • Eabi_Postoffice_Block_Config_Rebuildbutton
  • Eabi_Postoffice_Helper_Countrycode
  • Eabi_Postoffice_Helper_Data
  • Eabi_Postoffice_IndexController
  • Eabi_Postoffice_Model_Carrier_Abstract
  • Eabi_Postoffice_Model_Carrier_Result
  • Eabi_Postoffice_Model_Carriermodule
  • Eabi_Postoffice_Model_Mysql4_Carriermodule
  • Eabi_Postoffice_Model_Mysql4_Carriermodule_Collection
  • Eabi_Postoffice_Model_Mysql4_Office
  • Eabi_Postoffice_Model_Mysql4_Office_Collection
  • Eabi_Postoffice_Model_Observer
  • Eabi_Postoffice_Model_Office
  • Eabi_Postoffice_Model_Orderview
  • Eabi_Postoffice_Model_Source_Sendevent
  • Eabi_Postoffice_Model_Updater
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: /*
  3: 
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * or OpenGPL v3 license (GNU Public License V3.0)
  9:  * that is bundled with this package in the file LICENSE.txt.
 10:  * It is also available through the world-wide-web at this URL:
 11:  * http://opensource.org/licenses/osl-3.0.php
 12:  * or
 13:  * http://www.gnu.org/licenses/gpl-3.0.txt
 14:  * If you did not receive a copy of the license and are unable to
 15:  * obtain it through the world-wide-web, please send an email
 16:  * to info@e-abi.ee so we can send you a copy immediately.
 17:  *
 18:  * DISCLAIMER
 19:  *
 20:  * Do not edit or add to this file if you wish to upgrade this module to newer
 21:  * versions in the future.
 22:  *
 23:  * @category   Eabi
 24:  * @package    Eabi_Dpd
 25:  * @copyright  Copyright (c) 2014 Aktsiamaailm LLC (http://en.e-abi.ee/)
 26:  * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 27:  * @license    http://www.gnu.org/licenses/gpl-3.0.txt  GNU Public License V3.0
 28:  * @author     Matis Halmann
 29:  * 
 30:  
 31:  */
 32: 
 33: /**
 34:  * <p>Handles the AJAX request defined for the frontend (from database table eabi_livehandler)</p>
 35:  * <p>Security model: If Page itself can be displayed, then it is allowed to run actions, which are bound to current Livehandler model. If user switches page, then current model actions cannot be run any more.</p>
 36:  * <p>If user does not show any activity for Eabi_Livehandler_IndexController::ALLOWED time seconds, then actions cannot be run after timeout.</p>
 37:  * 
 38:  *
 39:  * @author matishalmann
 40:  */
 41: class Eabi_Livehandler_IndexController extends Mage_Core_Controller_Front_Action {
 42:     const ALLOWED_TIME = 1800;
 43:     public function processAction() {
 44:         $result = array();
 45:         if (!$this->_getEabi()->getConfigData('eabi_livehandler/main/enabled')) {
 46:             throw new Exception('Module Eabi Livehandler is not enabled');
 47:         }
 48:         /*
 49:          * Check if the process is in Session allowed list.
 50:          * 
 51:          */
 52:         $session = Mage::getSingleton('core/session');
 53:         $time = time();
 54:         
 55:         $processName = base64_decode($this->getRequest()->getParam('__path'));
 56: //        $processName = $this->getRequest()->getParam('processName');
 57:         $processEntries = $session->getData('eabi_livehandler_entries');
 58:         $website = Mage::app()->getStore()->getWebsiteId();
 59:         $store = Mage::app()->getStore()->getStoreId();
 60: 
 61:         
 62:         if (is_array($processEntries) && isset($processEntries[$processName]) && $time - $processEntries[$processName] < self::ALLOWED_TIME) {
 63:             
 64:             
 65:             //execute the action.
 66:             $isAdmin = false;
 67:             $model = $processName;
 68:             
 69:             //get action by action name, website, store, is_admin = false
 70:             $actionsCollection = Mage::getModel('eabi_livehandler/entry')->getCollection()->setModelFilter($model, $isAdmin, $website, $store);
 71:             
 72:             $result = array();
 73:             $classesRan = array();
 74:             foreach ($actionsCollection as $action) {
 75:                 $action->load($action->getId());
 76:                 if (isset($classesRan[$action->getModelClass()])) {
 77:                     continue;
 78:                 }
 79:                 
 80:                 if (!isset($result['_is_error']) || !$result['_is_error']) {
 81:                     $processEntries[$processName] = $time;
 82:                     $result = $action->runPublic($this->getRequest()->getPost());
 83:                 }
 84:                 $classesRan[$action->getModelClass()] = true;
 85:                 
 86:             }
 87:             
 88:             
 89:             
 90:             Mage::getSingleton('core/session')->setData('eabi_livehandler_entries', $processEntries);
 91:         }
 92:         
 93:         
 94:         echo Zend_Json::encode($result);
 95:         die();
 96:     }
 97:     
 98:     /**
 99:      * 
100:      * @return Eabi_Livehandler_Helper_Data
101:      */
102:     protected function _getEabi() {
103:         return Mage::helper('eabi');
104:     }
105:     
106: }
107: 
108: 
DPD Eesti - Pakivedu.ee Shipping module for Magento API documentation generated by ApiGen 2.8.0