Version Notes
First stable release 1.2.1
Download this release
Release Info
| Developer | Clarion Tech |
| Extension | MageTracking_TicketSystem |
| Version | 1.2.1 |
| Comparing to | |
| See all releases | |
Version 1.2.1
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat.php +33 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Cat.php +43 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit.php +47 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit/Form.php +38 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit/Tab/Form.php +99 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit/Tabs.php +44 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Grid.php +113 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem.php +33 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Cat.php +44 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit.php +111 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Form.php +40 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Newtabs.php +45 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Tab/Form.php +218 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Tab/Newform.php +131 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Tabs.php +45 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Grid.php +147 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail.php +43 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail/Form.php +39 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail/Tab/Form.php +163 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail/Tabs.php +46 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Setting.php +41 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Setting/Form.php +40 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Setting/Tab/Form.php +193 -0
- app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Setting/Tabs.php +46 -0
- app/code/community/MageTracking/TicketSystem/Block/Cat.php +39 -0
- app/code/community/MageTracking/TicketSystem/Block/Ticketsystem.php +40 -0
- app/code/community/MageTracking/TicketSystem/Block/Ticketsystem/Edit.php +132 -0
- app/code/community/MageTracking/TicketSystem/Block/Ticketsystem/Navigation.php +9 -0
- app/code/community/MageTracking/TicketSystem/Block/Ticketsystem/View.php +54 -0
- app/code/community/MageTracking/TicketSystem/Helper/Data.php +102 -0
- app/code/community/MageTracking/TicketSystem/Helper/Mail.php +159 -0
- app/code/community/MageTracking/TicketSystem/Helper/Mail_data.php +150 -0
- app/code/community/MageTracking/TicketSystem/Helper/Phpmailer.php +1897 -0
- app/code/community/MageTracking/TicketSystem/Helper/Smtp.php +1113 -0
- app/code/community/MageTracking/TicketSystem/Helper/Ticket.php +789 -0
- app/code/community/MageTracking/TicketSystem/Helper/TicketFunctions.php +550 -0
- app/code/community/MageTracking/TicketSystem/Helper/email-example.html +174 -0
- app/code/community/MageTracking/TicketSystem/Model/Answers.php +11 -0
- app/code/community/MageTracking/TicketSystem/Model/Cats.php +12 -0
- app/code/community/MageTracking/TicketSystem/Model/Groups.php +14 -0
- app/code/community/MageTracking/TicketSystem/Model/Mail.php +14 -0
- app/code/community/MageTracking/TicketSystem/Model/Messages.php +14 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Answers.php +12 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Answers/Collection.php +10 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Cats.php +12 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Cats/Collection.php +10 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Groups.php +12 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Groups/Collection.php +10 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Mail.php +12 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Mail/Collection.php +10 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Messages.php +24 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Settings.php +12 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Settings/Collection.php +10 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Ticketsystem.php +12 -0
- app/code/community/MageTracking/TicketSystem/Model/Mysql4/Ticketsystem/Collection.php +10 -0
- app/code/community/MageTracking/TicketSystem/Model/Settings.php +14 -0
- app/code/community/MageTracking/TicketSystem/Model/Status.php +26 -0
- app/code/community/MageTracking/TicketSystem/Model/Ticketsystem.php +147 -0
- app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/CatController.php +180 -0
- app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/MailController.php +117 -0
- app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/SettingController.php +121 -0
- app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/TicketsystemController.php +676 -0
- app/code/community/MageTracking/TicketSystem/controllers/IndexController.php +371 -0
- app/code/community/MageTracking/TicketSystem/etc/config.xml +191 -0
- app/code/community/MageTracking/TicketSystem/sql/ticketsystem_setup/mysql4-install-1.2.1.php +181 -0
- app/design/adminhtml/default/default/layout/ticketsystem.xml +21 -0
- app/design/frontend/base/default/layout/ticketsystem.xml +42 -0
- app/design/frontend/base/default/template/ticketsystem/add.phtml +155 -0
- app/design/frontend/base/default/template/ticketsystem/edit.phtml +109 -0
- app/design/frontend/base/default/template/ticketsystem/navigation.phtml +42 -0
- app/design/frontend/base/default/template/ticketsystem/view.phtml +75 -0
- app/etc/modules/MageTracking_TicketSystem.xml +9 -0
- package.xml +18 -0
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Cat extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 24 |
+
{
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
$this->_controller = 'adminhtml_cat';
|
| 28 |
+
$this->_blockGroup = 'ticketsystem';
|
| 29 |
+
$this->_headerText = Mage::helper('ticketsystem')->__('View Departments');
|
| 30 |
+
$this->_addButtonLabel = Mage::helper('ticketsystem')->__('New Department');
|
| 31 |
+
parent::__construct();
|
| 32 |
+
}
|
| 33 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Cat.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Cat extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 23 |
+
{
|
| 24 |
+
public function __construct()
|
| 25 |
+
{
|
| 26 |
+
parent::__construct();
|
| 27 |
+
|
| 28 |
+
$this->_objectId = 'id';
|
| 29 |
+
$this->_blockGroup = 'ticketsystem';
|
| 30 |
+
$this->_controller = 'adminhtml_cat';
|
| 31 |
+
|
| 32 |
+
$this->_updateButton('save', 'label', Mage::helper('ticketsystem')->__('Save Department'));
|
| 33 |
+
$this->_updateButton('delete', 'label', Mage::helper('ticketsystem')->__('Delete Department'));
|
| 34 |
+
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public function getHeaderText()
|
| 38 |
+
{
|
| 39 |
+
if( Mage::registry('cat_data') ) {
|
| 40 |
+
return Mage::helper('ticketsystem')->__("Edit Department");
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit.php
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Cat_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 23 |
+
{
|
| 24 |
+
public function __construct()
|
| 25 |
+
{
|
| 26 |
+
parent::__construct();
|
| 27 |
+
|
| 28 |
+
$this->_objectId = 'id';
|
| 29 |
+
$this->_blockGroup = 'ticketsystem';
|
| 30 |
+
$this->_controller = 'adminhtml_ticketsystem';
|
| 31 |
+
|
| 32 |
+
$this->_updateButton('delete', 'label', Mage::helper('ticketsystem')->__('Delete Department'));
|
| 33 |
+
|
| 34 |
+
$this->_updateButton('save', 'label', Mage::helper('ticketsystem')->__('Save Department'));
|
| 35 |
+
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
public function getHeaderText()
|
| 40 |
+
{
|
| 41 |
+
if( Mage::registry('cat_data') && Mage::registry('cat_data')->getId() ) {
|
| 42 |
+
return Mage::helper('ticketsystem')->__("Edit Department '%s'", Mage::registry('cat_data')->getData('name'));
|
| 43 |
+
} else {
|
| 44 |
+
return Mage::helper('ticketsystem')->__('New Department');
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit/Form.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Cat_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 23 |
+
{
|
| 24 |
+
protected function _prepareForm()
|
| 25 |
+
{
|
| 26 |
+
$form = new Varien_Data_Form(array(
|
| 27 |
+
'id' => 'cat_form',
|
| 28 |
+
'action' => $this->getUrl('*/*/save'), array('id' => $this->getRequest()->getParam('id')),
|
| 29 |
+
'method' => 'post',
|
| 30 |
+
'enctype' => 'multipart/form-data'
|
| 31 |
+
)
|
| 32 |
+
);
|
| 33 |
+
|
| 34 |
+
$form->setUseContainer(true);
|
| 35 |
+
$this->setForm($form);
|
| 36 |
+
return parent::_prepareForm();
|
| 37 |
+
}
|
| 38 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit/Tab/Form.php
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Cat_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 23 |
+
{
|
| 24 |
+
|
| 25 |
+
protected function _prepareForm()
|
| 26 |
+
{
|
| 27 |
+
$form = new Varien_Data_Form();
|
| 28 |
+
$this->setForm($form);
|
| 29 |
+
$fieldset = $form->addFieldset('cat_form', array('legend'=>Mage::helper('ticketsystem')->__('Edit Department')));
|
| 30 |
+
|
| 31 |
+
$fieldset->addField('name', 'text', array(
|
| 32 |
+
'label' => Mage::helper('ticketsystem')->__('Name'),
|
| 33 |
+
'class' => 'required-entry',
|
| 34 |
+
'required' => true,
|
| 35 |
+
'name' => 'name',
|
| 36 |
+
));
|
| 37 |
+
|
| 38 |
+
/*$fieldset->addField('pophost', 'text', array(
|
| 39 |
+
'label' => Mage::helper('ticketsystem')->__('Pop 3 Host'),
|
| 40 |
+
'class' => 'required-entry',
|
| 41 |
+
'required' => true,
|
| 42 |
+
'name' => 'pophost',
|
| 43 |
+
));
|
| 44 |
+
|
| 45 |
+
$fieldset->addField('popuser', 'text', array(
|
| 46 |
+
'label' => Mage::helper('ticketsystem')->__('Pop 3 User'),
|
| 47 |
+
'class' => 'required-entry',
|
| 48 |
+
'required' => true,
|
| 49 |
+
'name' => 'popuser',
|
| 50 |
+
));
|
| 51 |
+
|
| 52 |
+
$fieldset->addField('poppass', 'password', array(
|
| 53 |
+
'label' => Mage::helper('ticketsystem')->__('Pop 3 Password'),
|
| 54 |
+
'class' => 'required-entry',
|
| 55 |
+
'required' => true,
|
| 56 |
+
'name' => 'poppass',
|
| 57 |
+
));*/
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
$fieldset->addField('email', 'text', array(
|
| 61 |
+
'label' => Mage::helper('ticketsystem')->__('Email'),
|
| 62 |
+
'class' => 'required-entry',
|
| 63 |
+
'required' => true,
|
| 64 |
+
'name' => 'email',
|
| 65 |
+
));
|
| 66 |
+
|
| 67 |
+
$fieldset->addField('signature', 'textarea', array(
|
| 68 |
+
'label' => Mage::helper('ticketsystem')->__('Signature'),
|
| 69 |
+
'class' => 'required-entry',
|
| 70 |
+
'required' => true,
|
| 71 |
+
'name' => 'signature',
|
| 72 |
+
'style' => 'width: 600px',
|
| 73 |
+
));
|
| 74 |
+
|
| 75 |
+
$fieldset->addField('hidden', 'hidden', array(
|
| 76 |
+
'label' => Mage::helper('ticketsystem')->__('Hidden'),
|
| 77 |
+
'name' => 'hidden',
|
| 78 |
+
));
|
| 79 |
+
|
| 80 |
+
$fieldset->addField('reply_method', 'select', array(
|
| 81 |
+
'name' => 'reply_method',
|
| 82 |
+
'label' => Mage::helper('ticketsystem')->__('Reply Method'),
|
| 83 |
+
'title' => Mage::helper('ticketsystem')->__('Reply Method'),
|
| 84 |
+
'class' => 'input-select',
|
| 85 |
+
'style' => 'width: 250px',
|
| 86 |
+
'options' => array('url' => Mage::helper('ticketsystem')->__('Send URL to load ticket'), 'message' => Mage::helper('ticketsystem')->__('Show message in email')),
|
| 87 |
+
));
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
if ( Mage::getSingleton('adminhtml/session')->getCatData() )
|
| 91 |
+
{
|
| 92 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getCatData());
|
| 93 |
+
Mage::getSingleton('adminhtml/session')->setCatData(null);
|
| 94 |
+
} elseif ( Mage::registry('cat_data') ) {
|
| 95 |
+
$form->setValues(Mage::registry('cat_data')->getData());
|
| 96 |
+
}
|
| 97 |
+
return parent::_prepareForm();
|
| 98 |
+
}
|
| 99 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Edit/Tabs.php
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Cat_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 23 |
+
{
|
| 24 |
+
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
$this->setId('cat_tabs');
|
| 28 |
+
$this->setDestElementId('edit_form');
|
| 29 |
+
$this->setTitle(Mage::helper('ticketsystem')->__('Departments'));
|
| 30 |
+
parent::__construct();
|
| 31 |
+
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
protected function _beforeToHtml()
|
| 35 |
+
{
|
| 36 |
+
$this->addTab('form_section', array(
|
| 37 |
+
'label' => Mage::helper('ticketsystem')->__('Departments'),
|
| 38 |
+
'title' => Mage::helper('ticketsystem')->__('Departments'),
|
| 39 |
+
'content' => $this->getLayout()->createBlock('ticketsystem/adminhtml_cat_edit_tab_form')->toHtml(),
|
| 40 |
+
));
|
| 41 |
+
|
| 42 |
+
return parent::_beforeToHtml();
|
| 43 |
+
}
|
| 44 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Cat/Grid.php
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Cat_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 23 |
+
{
|
| 24 |
+
public function __construct()
|
| 25 |
+
{
|
| 26 |
+
parent::__construct();
|
| 27 |
+
$this->setId('catGrid');
|
| 28 |
+
$this->setDefaultSort('name');
|
| 29 |
+
$this->setDefaultDir('ASC');
|
| 30 |
+
$this->setSaveParametersInSession(true);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
protected function _prepareCollection()
|
| 34 |
+
{
|
| 35 |
+
$collection = Mage::getModel('ticketsystem/cats')->getCollection();
|
| 36 |
+
$this->setCollection($collection);
|
| 37 |
+
return parent::_prepareCollection();
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
protected function _prepareColumns()
|
| 42 |
+
{
|
| 43 |
+
$this->addColumn('ID', array(
|
| 44 |
+
'header' => Mage::helper('ticketsystem')->__('ID'),
|
| 45 |
+
'align' =>'right',
|
| 46 |
+
'width' => '50px',
|
| 47 |
+
'index' => 'ID',
|
| 48 |
+
));
|
| 49 |
+
|
| 50 |
+
$this->addColumn('name', array(
|
| 51 |
+
'header' => Mage::helper('ticketsystem')->__('Name'),
|
| 52 |
+
'align' =>'left',
|
| 53 |
+
'index' => 'name',
|
| 54 |
+
));
|
| 55 |
+
|
| 56 |
+
$this->addColumn('email', array(
|
| 57 |
+
'header' => Mage::helper('ticketsystem')->__('Email'),
|
| 58 |
+
'align' =>'left',
|
| 59 |
+
'index' => 'email',
|
| 60 |
+
));
|
| 61 |
+
|
| 62 |
+
$this->addColumn('signature', array(
|
| 63 |
+
'header' => Mage::helper('ticketsystem')->__('Signature'),
|
| 64 |
+
'align' =>'left',
|
| 65 |
+
'index' => 'signature',
|
| 66 |
+
));
|
| 67 |
+
|
| 68 |
+
$this->addColumn('Action',
|
| 69 |
+
array(
|
| 70 |
+
'header' => Mage::helper('ticketsystem')->__('Action'),
|
| 71 |
+
'width' => '100',
|
| 72 |
+
'type' => 'action',
|
| 73 |
+
'getter' => 'getId',
|
| 74 |
+
'actions' => array(
|
| 75 |
+
array(
|
| 76 |
+
'caption' => Mage::helper('ticketsystem')->__('Edit'),
|
| 77 |
+
'url' => array('base'=> '*/*/edit'),
|
| 78 |
+
'field' => 'id'
|
| 79 |
+
),
|
| 80 |
+
),
|
| 81 |
+
'filter' => false,
|
| 82 |
+
'sortable' => false,
|
| 83 |
+
'index' => 'stores',
|
| 84 |
+
'is_system' => true,
|
| 85 |
+
));
|
| 86 |
+
|
| 87 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('ticketsystem')->__('CSV'));
|
| 88 |
+
$this->addExportType('*/*/exportXml', Mage::helper('ticketsystem')->__('XML'));
|
| 89 |
+
|
| 90 |
+
return parent::_prepareColumns();
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
protected function _prepareMassaction()
|
| 94 |
+
{
|
| 95 |
+
$this->setMassactionIdField('ticketsystem_id');
|
| 96 |
+
$this->getMassactionBlock()->setFormFieldName('ticketsystem');
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 100 |
+
'label' => Mage::helper('ticketsystem')->__('Delete'),
|
| 101 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
| 102 |
+
'confirm' => Mage::helper('ticketsystem')->__('Are you sure?')
|
| 103 |
+
));
|
| 104 |
+
|
| 105 |
+
return $this;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
public function getRowUrl($row)
|
| 109 |
+
{
|
| 110 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem extends Mage_Adminhtml_Block_Widget_Grid_Container
|
| 24 |
+
{
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
$this->_controller = 'adminhtml_ticketsystem';
|
| 28 |
+
$this->_blockGroup = 'ticketsystem';
|
| 29 |
+
$this->_headerText = Mage::helper('ticketsystem')->__('View Tickets');
|
| 30 |
+
$this->_addButtonLabel = Mage::helper('ticketsystem')->__('New Ticket');
|
| 31 |
+
parent::__construct();
|
| 32 |
+
}
|
| 33 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Cat.php
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Cat extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 24 |
+
{
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
parent::__construct();
|
| 28 |
+
|
| 29 |
+
$this->_objectId = 'id';
|
| 30 |
+
$this->_blockGroup = 'cat';
|
| 31 |
+
$this->_controller = 'adminhtml_cat';
|
| 32 |
+
|
| 33 |
+
$this->_updateButton('save', 'label', Mage::helper('ticketsystem')->__('Save Department'));
|
| 34 |
+
$this->_updateButton('delete', 'label', Mage::helper('ticketsystem')->__('Delete Department'));
|
| 35 |
+
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
public function getHeaderText()
|
| 39 |
+
{
|
| 40 |
+
if( Mage::registry('cat_data') ) {
|
| 41 |
+
return Mage::helper('ticketsystem')->__("Edit Department");
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit.php
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 1.0
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 25 |
+
{
|
| 26 |
+
public function __construct()
|
| 27 |
+
{
|
| 28 |
+
parent::__construct();
|
| 29 |
+
|
| 30 |
+
$this->_objectId = 'id';
|
| 31 |
+
$this->_blockGroup = 'ticketsystem';
|
| 32 |
+
$this->_controller = 'adminhtml_ticketsystem';
|
| 33 |
+
|
| 34 |
+
$this->_updateButton('delete', 'label', Mage::helper('ticketsystem')->__('Delete Ticket'));
|
| 35 |
+
|
| 36 |
+
if( $this->getId() )
|
| 37 |
+
$this->_updateButton('save', 'label', Mage::helper('ticketsystem')->__('Reply to Message'));
|
| 38 |
+
else
|
| 39 |
+
$this->_updateButton('save', 'label', Mage::helper('ticketsystem')->__('Save Ticket'));
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
if($this->getId() )
|
| 43 |
+
$this->_addButton('transfer_cats', array(
|
| 44 |
+
'label' => Mage::helper('ticketsystem')->__('Transfer Department'),
|
| 45 |
+
'class' => 'transfer_cats',
|
| 46 |
+
'onclick' => 'transferCats(\''. $this->getUrl('*/*/transcat', array("id" => $this->getRequest()->getParam("id"))) .'\')',
|
| 47 |
+
'level' => -1
|
| 48 |
+
), 100);
|
| 49 |
+
|
| 50 |
+
if($this->getId() )
|
| 51 |
+
$this->_addButton('newstat', array(
|
| 52 |
+
'label' => Mage::helper('ticketsystem')->__('Set New Status'),
|
| 53 |
+
'class' => 'newstat',
|
| 54 |
+
'onclick' => 'newStatus(\''. $this->getUrl('*/*/setstat', array("id" => $this->getRequest()->getParam("id"))) .'\')',
|
| 55 |
+
'level' => -1
|
| 56 |
+
), 100);
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
$this->_formScripts[] = "
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
function newStatus(url){
|
| 64 |
+
var newStatus= document.forms['edit_form'].new_status.value;
|
| 65 |
+
if (newStatus =='0'){
|
| 66 |
+
alert('". Mage::helper('ticketsystem')->__('Please select a status'). "');
|
| 67 |
+
}else{
|
| 68 |
+
document.forms['edit_form'].action=url+'new_status/'+newStatus+'/';
|
| 69 |
+
document.forms['edit_form'].submit();
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
function transferReps(url){
|
| 74 |
+
var representative= document.forms['edit_form'].rep.value;
|
| 75 |
+
if (representative =='0'){
|
| 76 |
+
alert('". Mage::helper('ticketsystem')->__('Please select a representative'). "');
|
| 77 |
+
}else{
|
| 78 |
+
document.forms['edit_form'].action=url+'reps/'+representative+'/';
|
| 79 |
+
document.forms['edit_form'].submit();
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
function transferCats(url){
|
| 84 |
+
var category= document.forms['edit_form'].cat.value;
|
| 85 |
+
var cats_message= document.forms['edit_form'].trans_msg.value;
|
| 86 |
+
var cat_alert= document.forms['edit_form'].cat_alert.value;
|
| 87 |
+
if (category =='0'){
|
| 88 |
+
alert('". Mage::helper('ticketsystem')->__('Please select a department'). "');
|
| 89 |
+
}else{
|
| 90 |
+
document.forms['edit_form'].action=url+'cats/'+category+'/'+'message/'+ cats_message +'/cat_alert/'+cat_alert+'/';
|
| 91 |
+
document.forms['edit_form'].submit();
|
| 92 |
+
}
|
| 93 |
+
}
|
| 94 |
+
";
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
public function getId()
|
| 99 |
+
{
|
| 100 |
+
return (Mage::registry('ticketsystem_data') && Mage::registry('ticketsystem_data')->getId());
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
public function getHeaderText()
|
| 104 |
+
{
|
| 105 |
+
if( $this->getId() ) {
|
| 106 |
+
return Mage::helper('ticketsystem')->__("Edit Ticket '%s'", $this->htmlEscape(Mage::registry('ticketsystem_data')->getId()));
|
| 107 |
+
} else {
|
| 108 |
+
return Mage::helper('ticketsystem')->__('New Ticket');
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Form.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 23 |
+
{
|
| 24 |
+
protected function _prepareForm()
|
| 25 |
+
{
|
| 26 |
+
$form = new Varien_Data_Form(array(
|
| 27 |
+
'id' => 'edit_form',
|
| 28 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
| 29 |
+
'method' => 'post',
|
| 30 |
+
'enctype' => 'multipart/form-data'
|
| 31 |
+
)
|
| 32 |
+
);
|
| 33 |
+
|
| 34 |
+
$form->setUseContainer(true);
|
| 35 |
+
$this->setForm($form);
|
| 36 |
+
return parent::_prepareForm();
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Newtabs.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Edit_NewTabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 23 |
+
{
|
| 24 |
+
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
parent::__construct();
|
| 28 |
+
$this->setId('ticketsystem_tabs');
|
| 29 |
+
$this->setDestElementId('edit_form');
|
| 30 |
+
$this->setTitle(Mage::helper('ticketsystem')->__('Ticket Information'));
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
protected function _beforeToHtml()
|
| 34 |
+
{
|
| 35 |
+
$this->addTab('form_section', array(
|
| 36 |
+
'label' => Mage::helper('ticketsystem')->__('Ticket Information'),
|
| 37 |
+
'title' => Mage::helper('ticketsystem')->__('Ticket Information'),
|
| 38 |
+
'content' => $this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_edit_tab_newform')->toHtml(),
|
| 39 |
+
));
|
| 40 |
+
|
| 41 |
+
return parent::_beforeToHtml();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Tab/Form.php
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 23 |
+
{
|
| 24 |
+
protected function _prepareForm()
|
| 25 |
+
{
|
| 26 |
+
$form = new Varien_Data_Form();
|
| 27 |
+
$this->setForm($form);
|
| 28 |
+
$fieldset = $form->addFieldset('ticketsystem_form', array('legend'=>Mage::helper('ticketsystem')->__('Ticket Information')));
|
| 29 |
+
|
| 30 |
+
$fieldset->addField('ID', 'label', array(
|
| 31 |
+
'label' => Mage::helper('ticketsystem')->__('Ticket ID'),
|
| 32 |
+
'id' => 'ID',
|
| 33 |
+
'name' => 'ID',
|
| 34 |
+
));
|
| 35 |
+
$fieldset->addField('hidden_ID', 'hidden', array(
|
| 36 |
+
'label' => Mage::helper('ticketsystem')->__('Ticket ID'),
|
| 37 |
+
'id' => 'hidden_ID',
|
| 38 |
+
'name' => 'hidden_ID',
|
| 39 |
+
));
|
| 40 |
+
|
| 41 |
+
$fieldset->addField('status', 'label', array(
|
| 42 |
+
'name' => 'status',
|
| 43 |
+
'label' => Mage::helper('ticketsystem')->__('Status'),
|
| 44 |
+
'id' => 'status',
|
| 45 |
+
'title' => Mage::helper('ticketsystem')->__('Status'),
|
| 46 |
+
));
|
| 47 |
+
$fieldset->addField('hidden_status', 'hidden', array(
|
| 48 |
+
'name' => 'hidden_status',
|
| 49 |
+
'label' => Mage::helper('ticketsystem')->__('Status'),
|
| 50 |
+
'id' => 'hidden_status',
|
| 51 |
+
'title' => Mage::helper('ticketsystem')->__('Status'),
|
| 52 |
+
));
|
| 53 |
+
|
| 54 |
+
$fieldset->addField('subject', 'label', array(
|
| 55 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 56 |
+
'id' => 'subject',
|
| 57 |
+
'name' => 'subject',
|
| 58 |
+
));
|
| 59 |
+
$fieldset->addField('hidden_subject', 'hidden', array(
|
| 60 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 61 |
+
'id' => 'hidden_subject',
|
| 62 |
+
'name' => 'hidden_subject',
|
| 63 |
+
));
|
| 64 |
+
|
| 65 |
+
$fieldset->addField('name', 'label', array(
|
| 66 |
+
'label' => Mage::helper('ticketsystem')->__('Name'),
|
| 67 |
+
'id' => 'name',
|
| 68 |
+
'name' => 'name',
|
| 69 |
+
));
|
| 70 |
+
$fieldset->addField('hidden_name', 'hidden', array(
|
| 71 |
+
'label' => Mage::helper('ticketsystem')->__('Name'),
|
| 72 |
+
'id' => 'hidden_name',
|
| 73 |
+
'name' => 'hidden_name',
|
| 74 |
+
));
|
| 75 |
+
|
| 76 |
+
$fieldset->addField('email', 'label', array(
|
| 77 |
+
'label' => Mage::helper('ticketsystem')->__('Email'),
|
| 78 |
+
'id' => 'email',
|
| 79 |
+
'name' => 'email',
|
| 80 |
+
));
|
| 81 |
+
$fieldset->addField('hidden_email', 'hidden', array(
|
| 82 |
+
'label' => Mage::helper('ticketsystem')->__('Email'),
|
| 83 |
+
'id' => 'hidden_email',
|
| 84 |
+
'name' => 'hidden_email',
|
| 85 |
+
));
|
| 86 |
+
|
| 87 |
+
$fieldset->addField('phone', 'label', array(
|
| 88 |
+
'label' => Mage::helper('ticketsystem')->__('Phone'),
|
| 89 |
+
'id' => 'phone',
|
| 90 |
+
'name' => 'phone',
|
| 91 |
+
));
|
| 92 |
+
$fieldset->addField('hidden_phone', 'hidden', array(
|
| 93 |
+
'label' => Mage::helper('ticketsystem')->__('Phone'),
|
| 94 |
+
'id' => 'hidden_phone',
|
| 95 |
+
'phone' => 'hidden_phone',
|
| 96 |
+
));
|
| 97 |
+
|
| 98 |
+
$fieldset->addField('orders', 'label', array(
|
| 99 |
+
'label' => Mage::helper('ticketsystem')->__('Order'),
|
| 100 |
+
'id' => 'orders',
|
| 101 |
+
'name' => 'orders',
|
| 102 |
+
));
|
| 103 |
+
$fieldset->addField('hidden_order', 'hidden', array(
|
| 104 |
+
'label' => Mage::helper('ticketsystem')->__('Order'),
|
| 105 |
+
'id' => 'hidden_order',
|
| 106 |
+
'phone' => 'hidden_order',
|
| 107 |
+
));
|
| 108 |
+
|
| 109 |
+
$fieldset->addField('priority', 'select', array(
|
| 110 |
+
'name' => 'priority',
|
| 111 |
+
'label' => Mage::helper('ticketsystem')->__('Priority'),
|
| 112 |
+
'id' => 'priority',
|
| 113 |
+
'title' => Mage::helper('ticketsystem')->__('Priority'),
|
| 114 |
+
'class' => 'input-select',
|
| 115 |
+
'style' => 'width: 250px',
|
| 116 |
+
'options' => array('1' => Mage::helper('ticketsystem')->__('Low'), '2' => Mage::helper('ticketsystem')->__('Medium'), '3' => Mage::helper('ticketsystem')->__('High')),
|
| 117 |
+
));
|
| 118 |
+
|
| 119 |
+
$fieldset->addField('cat', 'select', array(
|
| 120 |
+
'name' => 'cat',
|
| 121 |
+
'label' => Mage::helper('ticketsystem')->__('Department'),
|
| 122 |
+
'id' => 'cat',
|
| 123 |
+
'title' => Mage::helper('ticketsystem')->__('Department'),
|
| 124 |
+
'class' => 'input-select',
|
| 125 |
+
'style' => 'width: 250px',
|
| 126 |
+
'options' => $this->getCategories(),
|
| 127 |
+
));
|
| 128 |
+
|
| 129 |
+
if ((Mage::registry('ticketsystem_data')->getData('trans_note'))){
|
| 130 |
+
$fieldset->addField('trans_note', 'textarea', array(
|
| 131 |
+
'label' => Mage::helper('ticketsystem')->__('Transfer Note'),
|
| 132 |
+
'required' => false,
|
| 133 |
+
'name' => 'trans_note',
|
| 134 |
+
'style' => 'width: 600px; rows:5; background:#f2f2f2; height: 50px;',
|
| 135 |
+
'readonly' => 'readonly',
|
| 136 |
+
));
|
| 137 |
+
}
|
| 138 |
+
$fieldset->addField('trans_msg', 'textarea', array(
|
| 139 |
+
'label' => Mage::helper('ticketsystem')->__('Optional Department Message'),
|
| 140 |
+
'required' => false,
|
| 141 |
+
'name' => 'trans_msg',
|
| 142 |
+
'style' => 'width: 600px; height: 60px;',
|
| 143 |
+
));
|
| 144 |
+
$fieldset->addField('cat_alert', 'checkbox', array(
|
| 145 |
+
'name' => 'cat_alert',
|
| 146 |
+
'label' => Mage::helper('ticketsystem')->__('Department Send Alert'),
|
| 147 |
+
'class' => 'attribute-checkbox',
|
| 148 |
+
));
|
| 149 |
+
|
| 150 |
+
$fieldset->addField('message', 'textarea', array(
|
| 151 |
+
'label' => Mage::helper('ticketsystem')->__('Message'),
|
| 152 |
+
'required' => false,
|
| 153 |
+
'name' => 'message',
|
| 154 |
+
'class' => 'input-select',
|
| 155 |
+
'style' => 'width: 600px; background:#f2f2f2; height: 120px;',
|
| 156 |
+
'readonly' => 'readonly',
|
| 157 |
+
));
|
| 158 |
+
|
| 159 |
+
$statuses= Mage::getSingleton('ticketsystem/status');
|
| 160 |
+
|
| 161 |
+
$fieldset->addField('new_status', 'select', array(
|
| 162 |
+
'name' => 'new_status',
|
| 163 |
+
'label' => Mage::helper('ticketsystem')->__('New Status'),
|
| 164 |
+
'id' => 'new_status',
|
| 165 |
+
'title' => Mage::helper('ticketsystem')->__('New Status'),
|
| 166 |
+
'class' => 'input-select',
|
| 167 |
+
'style' => 'width: 150px',
|
| 168 |
+
'options' => $statuses->getOptionArray(),
|
| 169 |
+
));
|
| 170 |
+
|
| 171 |
+
$fieldset->addField('answer', 'textarea', array(
|
| 172 |
+
'label' => Mage::helper('ticketsystem')->__('Answer'),
|
| 173 |
+
'required' => false,
|
| 174 |
+
'name' => 'answer',
|
| 175 |
+
'style' => 'width: 600px; height: 120px;',
|
| 176 |
+
));
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
if ( Mage::getSingleton('adminhtml/session')->getTicketSystemData() )
|
| 180 |
+
{
|
| 181 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getTicketSystemData());
|
| 182 |
+
Mage::getSingleton('adminhtml/session')->setTicketSystemData(null);
|
| 183 |
+
} elseif ( Mage::registry('ticketsystem_data') ) {
|
| 184 |
+
$form->setValues(Mage::registry('ticketsystem_data')->getData());
|
| 185 |
+
}
|
| 186 |
+
return parent::_prepareForm();
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
public function getRepresantatives()
|
| 190 |
+
{
|
| 191 |
+
//$reps=Mage::registry('ticketsystem_represantatives');
|
| 192 |
+
$model_reps= Mage::getModel('admin/user');
|
| 193 |
+
$return_array=array();
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
foreach ($model_reps->getCollection()->load() as $key=>$val) {
|
| 197 |
+
$name=$val->getData('firstname').' '.$val->getData('lastname');
|
| 198 |
+
$return_array[$val->getData('user_id')]= $name;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
return $return_array;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
public function getCategories() {
|
| 205 |
+
$cats=Mage::registry('ticketsystem_categories');
|
| 206 |
+
$return_array=array();
|
| 207 |
+
array_unshift($return_array,'');
|
| 208 |
+
if ($cats)
|
| 209 |
+
foreach ($cats as $key=>$val){
|
| 210 |
+
if ($val){
|
| 211 |
+
$name=$val->getData('name');
|
| 212 |
+
$return_array[$val->getData('ID')]= $name;
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
return $return_array;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Tab/Newform.php
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Edit_Tab_NewForm extends Mage_Adminhtml_Block_Widget_Form
|
| 23 |
+
{
|
| 24 |
+
protected function _prepareForm()
|
| 25 |
+
{
|
| 26 |
+
$form = new Varien_Data_Form();
|
| 27 |
+
$this->setForm($form);
|
| 28 |
+
$fieldset = $form->addFieldset('ticketsystem_form', array('legend'=>Mage::helper('ticketsystem')->__('Ticket information')));
|
| 29 |
+
|
| 30 |
+
$fieldset->addField('name', 'text', array(
|
| 31 |
+
'label' => Mage::helper('ticketsystem')->__('Name'),
|
| 32 |
+
'id' => 'name',
|
| 33 |
+
'name' => 'name',
|
| 34 |
+
'class' => 'required-entry',
|
| 35 |
+
'required' => true,
|
| 36 |
+
));
|
| 37 |
+
|
| 38 |
+
$fieldset->addField('subject', 'text', array(
|
| 39 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 40 |
+
'id' => 'subject',
|
| 41 |
+
'name' => 'subject',
|
| 42 |
+
'class' => 'required-entry',
|
| 43 |
+
'required' => true,
|
| 44 |
+
));
|
| 45 |
+
|
| 46 |
+
$fieldset->addField('email', 'text', array(
|
| 47 |
+
'label' => Mage::helper('ticketsystem')->__('Email'),
|
| 48 |
+
'id' => 'email',
|
| 49 |
+
'name' => 'email',
|
| 50 |
+
'class' => 'required-entry',
|
| 51 |
+
'required' => true,
|
| 52 |
+
));
|
| 53 |
+
|
| 54 |
+
$fieldset->addField('phone', 'text', array(
|
| 55 |
+
'label' => Mage::helper('ticketsystem')->__('Phone'),
|
| 56 |
+
'id' => 'phone',
|
| 57 |
+
'name' => 'phone',
|
| 58 |
+
'required' => false,
|
| 59 |
+
));
|
| 60 |
+
|
| 61 |
+
$fieldset->addField('orders', 'text', array(
|
| 62 |
+
'label' => Mage::helper('ticketsystem')->__('Order'),
|
| 63 |
+
'id' => 'order',
|
| 64 |
+
'name' => 'orders',
|
| 65 |
+
'required' => false,
|
| 66 |
+
));
|
| 67 |
+
|
| 68 |
+
$fieldset->addField('priority', 'select', array(
|
| 69 |
+
'name' => 'priority',
|
| 70 |
+
'label' => Mage::helper('ticketsystem')->__('Priority'),
|
| 71 |
+
'id' => 'priority',
|
| 72 |
+
'title' => Mage::helper('ticketsystem')->__('Priority'),
|
| 73 |
+
'class' => 'required-entry',
|
| 74 |
+
'style' => 'width: 250px',
|
| 75 |
+
'required' => true,
|
| 76 |
+
'options' => array('1' => Mage::helper('ticketsystem')->__('Low'), '2' => Mage::helper('ticketsystem')->__('Medium'), '3' => Mage::helper('ticketsystem')->__('High')),
|
| 77 |
+
));
|
| 78 |
+
|
| 79 |
+
$fieldset->addField('cat', 'select', array(
|
| 80 |
+
'name' => 'cat',
|
| 81 |
+
'label' => Mage::helper('ticketsystem')->__('Department'),
|
| 82 |
+
'id' => 'cat',
|
| 83 |
+
'title' => Mage::helper('ticketsystem')->__('Department'),
|
| 84 |
+
'class' => 'input-select',
|
| 85 |
+
'style' => 'width: 250px',
|
| 86 |
+
'required' => true,
|
| 87 |
+
'options' => $this->getCategories(),
|
| 88 |
+
));
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
$fieldset->addField('message', 'textarea', array(
|
| 92 |
+
'label' => Mage::helper('ticketsystem')->__('Message'),
|
| 93 |
+
'required' => false,
|
| 94 |
+
'name' => 'message',
|
| 95 |
+
'style' => 'width: 600px',
|
| 96 |
+
'class' => 'required-entry',
|
| 97 |
+
'required' => true,
|
| 98 |
+
));
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
if ( Mage::getSingleton('adminhtml/session')->getTicketSystemData() )
|
| 102 |
+
{
|
| 103 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getTicketSystemData());
|
| 104 |
+
Mage::getSingleton('adminhtml/session')->setTicketSystemData(null);
|
| 105 |
+
} elseif ( Mage::registry('ticketsystem_data') ) {
|
| 106 |
+
$form->setValues(Mage::registry('ticketsystem_data')->getData());
|
| 107 |
+
}
|
| 108 |
+
return parent::_prepareForm();
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
public function getRepresantatives() {
|
| 112 |
+
$reps=Mage::registry('ticketsystem_represantatives');
|
| 113 |
+
$return_array=array();
|
| 114 |
+
foreach ($reps as $key=>$val){
|
| 115 |
+
$name=$val->getData('name');
|
| 116 |
+
$return_array[$key]= $name;
|
| 117 |
+
}
|
| 118 |
+
array_unshift($return_array,'');
|
| 119 |
+
return $return_array;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
public function getCategories() {
|
| 123 |
+
$cats=Mage::registry('ticketsystem_categories');
|
| 124 |
+
$return_array=array();
|
| 125 |
+
foreach ($cats as $key=>$val){
|
| 126 |
+
$name=$val->getData('name');
|
| 127 |
+
$return_array[$key]= $name;
|
| 128 |
+
}
|
| 129 |
+
return $return_array;
|
| 130 |
+
}
|
| 131 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Edit/Tabs.php
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 23 |
+
{
|
| 24 |
+
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
parent::__construct();
|
| 28 |
+
$this->setId('ticketsystem_tabs');
|
| 29 |
+
$this->setDestElementId('edit_form');
|
| 30 |
+
$this->setTitle(Mage::helper('ticketsystem')->__('Ticket Information'));
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
protected function _beforeToHtml()
|
| 34 |
+
{
|
| 35 |
+
$this->addTab('form_section', array(
|
| 36 |
+
'label' => Mage::helper('ticketsystem')->__('Ticket Information'),
|
| 37 |
+
'title' => Mage::helper('ticketsystem')->__('Ticket Information'),
|
| 38 |
+
'content' => $this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_edit_tab_form')->toHtml(),
|
| 39 |
+
));
|
| 40 |
+
|
| 41 |
+
return parent::_beforeToHtml();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Grid.php
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 24 |
+
{
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
parent::__construct();
|
| 28 |
+
$this->setId('ticketsystemGrid');
|
| 29 |
+
$this->setDefaultSort('timestamp');
|
| 30 |
+
$this->setDefaultDir('ASC');
|
| 31 |
+
$this->setSaveParametersInSession(true);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
protected function _prepareCollection()
|
| 36 |
+
{
|
| 37 |
+
$collection = Mage::getModel('ticketsystem/ticketsystem')->getCollection();
|
| 38 |
+
$this->setCollection($collection);
|
| 39 |
+
return parent::_prepareCollection();
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
protected function _prepareColumns()
|
| 43 |
+
{
|
| 44 |
+
$this->addColumn('timestamp', array(
|
| 45 |
+
'header' => Mage::helper('ticketsystem')->__('Timestamp'),
|
| 46 |
+
'align' =>'left',
|
| 47 |
+
'index' => 'timestamp',
|
| 48 |
+
'width' => '125px',
|
| 49 |
+
));
|
| 50 |
+
|
| 51 |
+
$this->addColumn('subject', array(
|
| 52 |
+
'header' => Mage::helper('ticketsystem')->__('Subject'),
|
| 53 |
+
'align' =>'left',
|
| 54 |
+
'index' => 'subject',
|
| 55 |
+
'width' => '200px',
|
| 56 |
+
));
|
| 57 |
+
|
| 58 |
+
$this->addColumn('ID', array(
|
| 59 |
+
'header' => Mage::helper('ticketsystem')->__('ID'),
|
| 60 |
+
'align' =>'right',
|
| 61 |
+
'width' => '70px',
|
| 62 |
+
'index' => 'ID',
|
| 63 |
+
));
|
| 64 |
+
|
| 65 |
+
$this->addColumn('name', array(
|
| 66 |
+
'header' => Mage::helper('ticketsystem')->__('Name'),
|
| 67 |
+
'align' =>'left',
|
| 68 |
+
'index' => 'name',
|
| 69 |
+
'width' => '200px',
|
| 70 |
+
));
|
| 71 |
+
|
| 72 |
+
$this->addColumn('email', array(
|
| 73 |
+
'header' => Mage::helper('ticketsystem')->__('Email'),
|
| 74 |
+
'width' => '250px',
|
| 75 |
+
'index' => 'email',
|
| 76 |
+
));
|
| 77 |
+
|
| 78 |
+
$statuses= Mage::getSingleton('ticketsystem/status')->getOptionArray();
|
| 79 |
+
$this->addColumn('status', array(
|
| 80 |
+
'header' => Mage::helper('ticketsystem')->__('Status'),
|
| 81 |
+
'align' => 'left',
|
| 82 |
+
'width' => '150px',
|
| 83 |
+
'index' => 'status',
|
| 84 |
+
'type' => 'options',
|
| 85 |
+
'options' => $statuses,
|
| 86 |
+
));
|
| 87 |
+
|
| 88 |
+
$this->addColumn('Action',
|
| 89 |
+
array(
|
| 90 |
+
'header' => Mage::helper('ticketsystem')->__('Action'),
|
| 91 |
+
'width' => '100',
|
| 92 |
+
'type' => 'action',
|
| 93 |
+
'getter' => 'getId',
|
| 94 |
+
'actions' => array(
|
| 95 |
+
array(
|
| 96 |
+
'caption' => Mage::helper('ticketsystem')->__('Edit'),
|
| 97 |
+
'url' => array('base'=> '*/*/edit'),
|
| 98 |
+
'field' => 'id'
|
| 99 |
+
)
|
| 100 |
+
),
|
| 101 |
+
'filter' => false,
|
| 102 |
+
'sortable' => false,
|
| 103 |
+
'index' => 'stores',
|
| 104 |
+
'is_system' => true,
|
| 105 |
+
));
|
| 106 |
+
|
| 107 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('ticketsystem')->__('CSV'));
|
| 108 |
+
$this->addExportType('*/*/exportXml', Mage::helper('ticketsystem')->__('XML'));
|
| 109 |
+
|
| 110 |
+
return parent::_prepareColumns();
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
protected function _prepareMassaction()
|
| 114 |
+
{
|
| 115 |
+
$this->setMassactionIdField('ticketsystem_id');
|
| 116 |
+
$this->getMassactionBlock()->setFormFieldName('ticketsystem');
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 120 |
+
'label' => Mage::helper('ticketsystem')->__('Delete'),
|
| 121 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
| 122 |
+
'confirm' => Mage::helper('ticketsystem')->__('Are you sure?')
|
| 123 |
+
));
|
| 124 |
+
|
| 125 |
+
$status = Mage::getSingleton('ticketsystem/status');
|
| 126 |
+
$this->getMassactionBlock()->addItem('status', array(
|
| 127 |
+
'label'=> Mage::helper('ticketsystem')->__('Change status'),
|
| 128 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
| 129 |
+
'additional' => array(
|
| 130 |
+
'visibility' => array(
|
| 131 |
+
'name' => 'status',
|
| 132 |
+
'type' => 'select',
|
| 133 |
+
'class' => 'required-entry',
|
| 134 |
+
'label' => Mage::helper('ticketsystem')->__('Status'),
|
| 135 |
+
'values' => $status->getOptionArray(),
|
| 136 |
+
)
|
| 137 |
+
)
|
| 138 |
+
));
|
| 139 |
+
return $this;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
public function getRowUrl($row)
|
| 143 |
+
{
|
| 144 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail.php
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Mail extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 25 |
+
{
|
| 26 |
+
public function __construct()
|
| 27 |
+
{
|
| 28 |
+
parent::__construct();
|
| 29 |
+
|
| 30 |
+
$this->_objectId = 'id';
|
| 31 |
+
$this->_blockGroup = 'ticketsystem';
|
| 32 |
+
$this->_controller = 'adminhtml_ticketsystem';
|
| 33 |
+
|
| 34 |
+
$this->_updateButton('save', 'label', Mage::helper('ticketsystem')->__('Save Mail Responses'));
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
public function getHeaderText()
|
| 38 |
+
{
|
| 39 |
+
if( Mage::registry('ticketsystem_maildata') ) {
|
| 40 |
+
return Mage::helper('ticketsystem')->__("Edit Mail Responses");
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail/Form.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Mail_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 24 |
+
{
|
| 25 |
+
protected function _prepareForm()
|
| 26 |
+
{
|
| 27 |
+
$form = new Varien_Data_Form(array(
|
| 28 |
+
'id' => 'mail_form',
|
| 29 |
+
'action' => $this->getUrl('*/*/save'),
|
| 30 |
+
'method' => 'post',
|
| 31 |
+
'enctype' => 'multipart/form-data'
|
| 32 |
+
)
|
| 33 |
+
);
|
| 34 |
+
|
| 35 |
+
$form->setUseContainer(true);
|
| 36 |
+
$this->setForm($form);
|
| 37 |
+
return parent::_prepareForm();
|
| 38 |
+
}
|
| 39 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail/Tab/Form.php
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Mail_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
protected function _prepareForm()
|
| 27 |
+
{
|
| 28 |
+
$form = new Varien_Data_Form();
|
| 29 |
+
$this->setForm($form);
|
| 30 |
+
$fieldset = $form->addFieldset('ticketsystem_mail', array('legend'=>Mage::helper('ticketsystem')->__('New Ticket Reply').' : '.Mage::helper('ticketsystem')->__('Message sent when a new ticket is opened')));
|
| 31 |
+
$data =Mage::registry('ticketsystem_maildata');
|
| 32 |
+
|
| 33 |
+
$fieldset->addField('ticket_response', 'checkbox', array(
|
| 34 |
+
'label' => Mage::helper('ticketsystem')->__('Enable'),
|
| 35 |
+
'title' => Mage::helper('ticketsystem')->__('Enable'),
|
| 36 |
+
'name' => 'ticket_response',
|
| 37 |
+
'id' => 'ticket_response',
|
| 38 |
+
'value' => 1,
|
| 39 |
+
'checked' => $data->getData('ticket_response')
|
| 40 |
+
));
|
| 41 |
+
|
| 42 |
+
$fieldset->addField('ticket_subj', 'text', array(
|
| 43 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 44 |
+
'class' => 'required-entry',
|
| 45 |
+
'required' => true,
|
| 46 |
+
'name' => 'ticket_subj',
|
| 47 |
+
));
|
| 48 |
+
|
| 49 |
+
$fieldset->addField('ticket_msg', 'textarea', array(
|
| 50 |
+
'label' => Mage::helper('ticketsystem')->__('Message'),
|
| 51 |
+
'class' => 'required-entry',
|
| 52 |
+
'required' => true,
|
| 53 |
+
'name' => 'ticket_msg',
|
| 54 |
+
));
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
$fieldset = $form->addFieldset('ticketsystem_newmessagereply', array('legend'=>Mage::helper('ticketsystem')->__('New Message Reply').' : '.Mage::helper('ticketsystem')->__('Message sent everytime a reply is made to a ticket.')));
|
| 59 |
+
|
| 60 |
+
$fieldset->addField('message_response', 'checkbox', array(
|
| 61 |
+
'label' => Mage::helper('ticketsystem')->__('Enable'),
|
| 62 |
+
'required' => false,
|
| 63 |
+
'name' => 'message_response',
|
| 64 |
+
'value' => 1,
|
| 65 |
+
'checked' => $data->getData('message_response')
|
| 66 |
+
));
|
| 67 |
+
|
| 68 |
+
$fieldset->addField('message_subj', 'text', array(
|
| 69 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 70 |
+
'class' => 'required-entry',
|
| 71 |
+
'required' => true,
|
| 72 |
+
'name' => 'message_subj',
|
| 73 |
+
));
|
| 74 |
+
|
| 75 |
+
$fieldset->addField('message_msg', 'textarea', array(
|
| 76 |
+
'label' => Mage::helper('ticketsystem')->__('Message'),
|
| 77 |
+
'class' => 'required-entry',
|
| 78 |
+
'required' => true,
|
| 79 |
+
'name' => 'message_msg',
|
| 80 |
+
));
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
$fieldset = $form->addFieldset('ticketsystem_categorytransfernotification', array('legend'=>Mage::helper('ticketsystem')->__('Department Transfer Notification').' : '.Mage::helper('ticketsystem')->__('Message sent when a message has been transfered to a different department.')));
|
| 85 |
+
|
| 86 |
+
$fieldset->addField('trans_response', 'checkbox', array(
|
| 87 |
+
'label' => Mage::helper('ticketsystem')->__('Enable'),
|
| 88 |
+
'required' => false,
|
| 89 |
+
'name' => 'trans_response',
|
| 90 |
+
'value' => 1,
|
| 91 |
+
'checked' => $data->getData('trans_response')
|
| 92 |
+
));
|
| 93 |
+
|
| 94 |
+
$fieldset->addField('trans_subj', 'text', array(
|
| 95 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 96 |
+
'class' => 'required-entry',
|
| 97 |
+
'required' => true,
|
| 98 |
+
'name' => 'trans_subj',
|
| 99 |
+
));
|
| 100 |
+
|
| 101 |
+
$fieldset->addField('trans_msg', 'textarea', array(
|
| 102 |
+
'label' => Mage::helper('ticketsystem')->__('Message'),
|
| 103 |
+
'class' => 'required-entry',
|
| 104 |
+
'required' => true,
|
| 105 |
+
'name' => 'trans_msg',
|
| 106 |
+
));
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
$fieldset = $form->addFieldset('softicket_answermessage', array('legend'=>Mage::helper('ticketsystem')->__('Answer Message').' : '.Mage::helper('ticketsystem')->__('Message sent when answering a ticket, changing it is not recommended.')));
|
| 113 |
+
|
| 114 |
+
$fieldset->addField('answer_subj', 'text', array(
|
| 115 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 116 |
+
'class' => 'required-entry',
|
| 117 |
+
'required' => true,
|
| 118 |
+
'name' => 'answer_subj',
|
| 119 |
+
));
|
| 120 |
+
|
| 121 |
+
$fieldset->addField('answer_msg', 'textarea', array(
|
| 122 |
+
'label' => Mage::helper('ticketsystem')->__('Message'),
|
| 123 |
+
'class' => 'required-entry',
|
| 124 |
+
'required' => true,
|
| 125 |
+
'name' => 'answer_msg',
|
| 126 |
+
));
|
| 127 |
+
/*
|
| 128 |
+
$fieldset = $form->addFieldset('ticketsystem_transresponse', array('legend'=>Mage::helper('ticketsystem')->__('Representative Transfer Notification').' : '.Mage::helper('ticketsystem')->__('Message sent when a ticket has been transfered to a different representative.')));
|
| 129 |
+
$fieldset->addField('rep_trans_response', 'checkbox', array(
|
| 130 |
+
'label' => Mage::helper('ticketsystem')->__('Enable'),
|
| 131 |
+
'required' => false,
|
| 132 |
+
'name' => 'rep_trans_response',
|
| 133 |
+
'value' => 1,
|
| 134 |
+
'checked' => $data->getData('rep_trans_response')
|
| 135 |
+
));
|
| 136 |
+
|
| 137 |
+
$fieldset->addField('rep_trans_subj', 'text', array(
|
| 138 |
+
'label' => Mage::helper('ticketsystem')->__('Subject'),
|
| 139 |
+
'class' => 'required-entry',
|
| 140 |
+
'required' => true,
|
| 141 |
+
'name' => 'rep_trans_subj',
|
| 142 |
+
));
|
| 143 |
+
|
| 144 |
+
$fieldset->addField('rep_trans_msg', 'textarea', array(
|
| 145 |
+
'label' => Mage::helper('ticketsystem')->__('Message'),
|
| 146 |
+
'class' => 'required-entry',
|
| 147 |
+
'required' => true,
|
| 148 |
+
'name' => 'rep_trans_msg',
|
| 149 |
+
));*/
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
if ( Mage::getSingleton('adminhtml/session')->getTicketsystemMailData() )
|
| 155 |
+
{
|
| 156 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getTicketsystemMailData());
|
| 157 |
+
Mage::getSingleton('adminhtml/session')->setSofTicketMailData(null);
|
| 158 |
+
} elseif ( Mage::registry('ticketsystem_maildata') ) {
|
| 159 |
+
$form->setValues(Mage::registry('ticketsystem_maildata')->getData());
|
| 160 |
+
}
|
| 161 |
+
return parent::_prepareForm();
|
| 162 |
+
}
|
| 163 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Mail/Tabs.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Mail_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
public function __construct()
|
| 28 |
+
{
|
| 29 |
+
$this->setId('ticketsystem_tabs');
|
| 30 |
+
$this->setDestElementId('edit_form');
|
| 31 |
+
$this->setTitle(Mage::helper('ticketsystem')->__('Mail Responses'));
|
| 32 |
+
parent::__construct();
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
protected function _beforeToHtml()
|
| 37 |
+
{
|
| 38 |
+
$this->addTab('form_section', array(
|
| 39 |
+
'label' => Mage::helper('ticketsystem')->__('Mail Responses'),
|
| 40 |
+
'title' => Mage::helper('ticketsystem')->__('Mail Responses'),
|
| 41 |
+
'content' => $this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_mail_tab_form')->toHtml(),
|
| 42 |
+
));
|
| 43 |
+
|
| 44 |
+
return parent::_beforeToHtml();
|
| 45 |
+
}
|
| 46 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Setting.php
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Setting extends Mage_Adminhtml_Block_Widget_Form_Container
|
| 24 |
+
{
|
| 25 |
+
public function __construct()
|
| 26 |
+
{
|
| 27 |
+
parent::__construct();
|
| 28 |
+
|
| 29 |
+
$this->_objectId = 'id';
|
| 30 |
+
$this->_blockGroup = 'ticketsystem';
|
| 31 |
+
$this->_controller = 'adminhtml_ticketsystem';
|
| 32 |
+
$this->_updateButton('save', 'label', Mage::helper('ticketsystem')->__('Save Settings'));
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function getHeaderText()
|
| 36 |
+
{
|
| 37 |
+
if( Mage::registry('ticketsystem_settingdata') ) {
|
| 38 |
+
return Mage::helper('ticketsystem')->__("Edit Settings");
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Setting/Form.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Setting_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 25 |
+
{
|
| 26 |
+
protected function _prepareForm()
|
| 27 |
+
{
|
| 28 |
+
$form = new Varien_Data_Form(array(
|
| 29 |
+
'id' => 'mail_form',
|
| 30 |
+
'action' => $this->getUrl('*/*/save'),
|
| 31 |
+
'method' => 'post',
|
| 32 |
+
'enctype' => 'multipart/form-data'
|
| 33 |
+
)
|
| 34 |
+
);
|
| 35 |
+
|
| 36 |
+
$form->setUseContainer(true);
|
| 37 |
+
$this->setForm($form);
|
| 38 |
+
return parent::_prepareForm();
|
| 39 |
+
}
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Setting_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
protected function _prepareForm()
|
| 27 |
+
{
|
| 28 |
+
$form = new Varien_Data_Form();
|
| 29 |
+
$this->setForm($form);
|
| 30 |
+
$fieldset = $form->addFieldset('ticketsystem_setting', array('legend'=>Mage::helper('ticketsystem')->__('Settings')));
|
| 31 |
+
$data =Mage::registry('ticketsystem_settingdata');
|
| 32 |
+
|
| 33 |
+
$fieldset->addField('answer_subj', 'text', array(
|
| 34 |
+
'label' => Mage::helper('ticketsystem')->__('Answer Subject'),
|
| 35 |
+
'required' => false,
|
| 36 |
+
'name' => 'answer_subj',
|
| 37 |
+
'style' => 'width: 600px',
|
| 38 |
+
));
|
| 39 |
+
|
| 40 |
+
$fieldset->addField('answer_msg', 'text', array(
|
| 41 |
+
'label' => Mage::helper('ticketsystem')->__('Answer Message'),
|
| 42 |
+
'required' => false,
|
| 43 |
+
'name' => 'answer_msg',
|
| 44 |
+
'style' => 'width: 600px',
|
| 45 |
+
));
|
| 46 |
+
|
| 47 |
+
$fieldset->addField('remove_tag', 'text', array(
|
| 48 |
+
'label' => Mage::helper('ticketsystem')->__('Remove Tag'),
|
| 49 |
+
'required' => false,
|
| 50 |
+
'name' => 'remove_tag',
|
| 51 |
+
'style' => 'width: 600px',
|
| 52 |
+
));
|
| 53 |
+
|
| 54 |
+
$fieldset->addField('ticket_subj', 'text', array(
|
| 55 |
+
'label' => Mage::helper('ticketsystem')->__('Ticket Subject'),
|
| 56 |
+
'required' => false,
|
| 57 |
+
'name' => 'ticket_subj',
|
| 58 |
+
'style' => 'width: 600px',
|
| 59 |
+
));
|
| 60 |
+
|
| 61 |
+
$fieldset->addField('ticket_msg', 'textarea', array(
|
| 62 |
+
'label' => Mage::helper('ticketsystem')->__('Ticket Message'),
|
| 63 |
+
'required' => false,
|
| 64 |
+
'name' => 'ticket_msg',
|
| 65 |
+
'style' => 'width: 600px',
|
| 66 |
+
));
|
| 67 |
+
|
| 68 |
+
$fieldset->addField('alert_subj', 'text', array(
|
| 69 |
+
'label' => Mage::helper('ticketsystem')->__('Alert Subject'),
|
| 70 |
+
'required' => false,
|
| 71 |
+
'name' => 'alert_subj',
|
| 72 |
+
'style' => 'width: 600px',
|
| 73 |
+
));
|
| 74 |
+
|
| 75 |
+
$fieldset->addField('alert_msg', 'text', array(
|
| 76 |
+
'label' => Mage::helper('ticketsystem')->__('Alert Message'),
|
| 77 |
+
'required' => false,
|
| 78 |
+
'name' => 'alert_msg',
|
| 79 |
+
'style' => 'width: 600px',
|
| 80 |
+
));
|
| 81 |
+
|
| 82 |
+
$fieldset->addField('alert_email', 'text', array(
|
| 83 |
+
'label' => Mage::helper('ticketsystem')->__('Alert Emails of Admins'),
|
| 84 |
+
'required' => false,
|
| 85 |
+
'name' => 'alert_email',
|
| 86 |
+
'style' => 'width: 600px',
|
| 87 |
+
));
|
| 88 |
+
|
| 89 |
+
$fieldset->addField('alert_user', 'text', array(
|
| 90 |
+
'label' => Mage::helper('ticketsystem')->__('Alert Emails of Users'),
|
| 91 |
+
'required' => false,
|
| 92 |
+
'name' => 'alert_user',
|
| 93 |
+
'style' => 'width: 600px',
|
| 94 |
+
));
|
| 95 |
+
|
| 96 |
+
$fieldset->addField('alert_new', 'checkbox', array(
|
| 97 |
+
'label' => Mage::helper('ticketsystem')->__('Alert New'),
|
| 98 |
+
'required' => false,
|
| 99 |
+
'name' => 'alert_new',
|
| 100 |
+
'style' => 'text-align:left;width: 20px',
|
| 101 |
+
'checked' => $data->getData('alert_new'),
|
| 102 |
+
'value' => 1,
|
| 103 |
+
));
|
| 104 |
+
|
| 105 |
+
$fieldset->addField('message_subj', 'text', array(
|
| 106 |
+
'label' => Mage::helper('ticketsystem')->__('Message Subject'),
|
| 107 |
+
'required' => false,
|
| 108 |
+
'name' => 'message_subj',
|
| 109 |
+
'style' => 'width: 600px',
|
| 110 |
+
));
|
| 111 |
+
|
| 112 |
+
$fieldset->addField('message_msg', 'textarea', array(
|
| 113 |
+
'label' => Mage::helper('ticketsystem')->__('Message Message'),
|
| 114 |
+
'required' => false,
|
| 115 |
+
'name' => 'message_msg',
|
| 116 |
+
'style' => 'width: 600px',
|
| 117 |
+
));
|
| 118 |
+
|
| 119 |
+
$fieldset->addField('trans_subj', 'text', array(
|
| 120 |
+
'label' => Mage::helper('ticketsystem')->__('Transfer Subject'),
|
| 121 |
+
'required' => false,
|
| 122 |
+
'name' => 'trans_subj',
|
| 123 |
+
'style' => 'width: 600px',
|
| 124 |
+
));
|
| 125 |
+
|
| 126 |
+
$fieldset->addField('trans_msg', 'textarea', array(
|
| 127 |
+
'label' => Mage::helper('ticketsystem')->__('Transfer Message'),
|
| 128 |
+
'required' => false,
|
| 129 |
+
'name' => 'trans_msg',
|
| 130 |
+
'style' => 'width: 600px',
|
| 131 |
+
));
|
| 132 |
+
|
| 133 |
+
$fieldset->addField('root_url', 'text', array(
|
| 134 |
+
'label' => Mage::helper('ticketsystem')->__('Root Url'),
|
| 135 |
+
'required' => false,
|
| 136 |
+
'name' => 'root_url',
|
| 137 |
+
'style' => 'width: 300px',
|
| 138 |
+
));
|
| 139 |
+
|
| 140 |
+
$fieldset->addField('smtp_host', 'text', array(
|
| 141 |
+
'label' => Mage::helper('ticketsystem')->__('Smtp Host'),
|
| 142 |
+
'required' => false,
|
| 143 |
+
'name' => 'smtp_host',
|
| 144 |
+
'style' => 'width: 300px',
|
| 145 |
+
));
|
| 146 |
+
|
| 147 |
+
$fieldset->addField('smtp_port', 'text', array(
|
| 148 |
+
'label' => Mage::helper('ticketsystem')->__('Smtp Port'),
|
| 149 |
+
'required' => false,
|
| 150 |
+
'name' => 'smtp_port',
|
| 151 |
+
'style' => 'width: 60px',
|
| 152 |
+
));
|
| 153 |
+
|
| 154 |
+
$fieldset->addField('smtp_auth', 'checkbox', array(
|
| 155 |
+
'label' => Mage::helper('ticketsystem')->__('Smtp Auth'),
|
| 156 |
+
'required' => false,
|
| 157 |
+
'name' => 'smtp_auth',
|
| 158 |
+
'style' => 'text-align:left;width: 20px',
|
| 159 |
+
'checked' => $data->getData('smtp_auth'),
|
| 160 |
+
'value' => 1,
|
| 161 |
+
));
|
| 162 |
+
|
| 163 |
+
$fieldset->addField('smtp_user', 'text', array(
|
| 164 |
+
'label' => Mage::helper('ticketsystem')->__('Smtp User'),
|
| 165 |
+
'required' => false,
|
| 166 |
+
'name' => 'smtp_user',
|
| 167 |
+
'style' => 'width: 150px',
|
| 168 |
+
));
|
| 169 |
+
|
| 170 |
+
$fieldset->addField('smtp_pass', 'password', array(
|
| 171 |
+
'label' => Mage::helper('ticketsystem')->__('Smtp Password'),
|
| 172 |
+
'required' => false,
|
| 173 |
+
'name' => 'smtp_pass',
|
| 174 |
+
'style' => 'width: 150px',
|
| 175 |
+
));
|
| 176 |
+
|
| 177 |
+
$fieldset->addField('sendmail_path', 'text', array(
|
| 178 |
+
'label' => Mage::helper('ticketsystem')->__('Send Mail Path'),
|
| 179 |
+
'required' => false,
|
| 180 |
+
'name' => 'sendmail_path',
|
| 181 |
+
'style' => 'width: 300px',
|
| 182 |
+
));
|
| 183 |
+
|
| 184 |
+
if ( Mage::getSingleton('adminhtml/session')->getTicketsystemSettingData() )
|
| 185 |
+
{
|
| 186 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getTicketsystemSettingData());
|
| 187 |
+
Mage::getSingleton('adminhtml/session')->getTicketsystemSettingData(null);
|
| 188 |
+
} elseif ( Mage::registry('ticketsystem_settingdata') ) {
|
| 189 |
+
$form->setValues(Mage::registry('ticketsystem_settingdata')->getData());
|
| 190 |
+
}
|
| 191 |
+
return parent::_prepareForm();
|
| 192 |
+
}
|
| 193 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Adminhtml/Ticketsystem/Setting/Tabs.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Adminhtml_Ticketsystem_Setting_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
public function __construct()
|
| 28 |
+
{
|
| 29 |
+
$this->setId('ticketsystem_tabs');
|
| 30 |
+
$this->setDestElementId('edit_form');
|
| 31 |
+
$this->setTitle(Mage::helper('ticketsystem')->__('Settings'));
|
| 32 |
+
parent::__construct();
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
protected function _beforeToHtml()
|
| 37 |
+
{
|
| 38 |
+
$this->addTab('form_section', array(
|
| 39 |
+
'label' => Mage::helper('ticketsystem')->__('Settings'),
|
| 40 |
+
'title' => Mage::helper('ticketsystem')->__('Settings'),
|
| 41 |
+
'content' => $this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_setting_tab_form')->toHtml(),
|
| 42 |
+
));
|
| 43 |
+
|
| 44 |
+
return parent::_beforeToHtml();
|
| 45 |
+
}
|
| 46 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Cat.php
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Cat extends Mage_Core_Block_Template
|
| 25 |
+
{
|
| 26 |
+
public function _prepareLayout()
|
| 27 |
+
{
|
| 28 |
+
return parent::_prepareLayout();
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function getCats()
|
| 32 |
+
{
|
| 33 |
+
if (!$this->hasData('ticketsystem')) {
|
| 34 |
+
$this->setData('ticketsystem', Mage::registry('ticketsystem'));
|
| 35 |
+
}
|
| 36 |
+
return $this->getData('ticketsystem');
|
| 37 |
+
|
| 38 |
+
}
|
| 39 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Ticketsystem.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Ticketsystem extends Mage_Core_Block_Template
|
| 25 |
+
{
|
| 26 |
+
public function _prepareLayout()
|
| 27 |
+
{
|
| 28 |
+
return parent::_prepareLayout();
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function getTicketsystem()
|
| 32 |
+
{
|
| 33 |
+
if (!$this->hasData('ticketsystem')) {
|
| 34 |
+
$this->setData('ticketsystem', Mage::registry('ticketsystem'));
|
| 35 |
+
}
|
| 36 |
+
return $this->getData('ticketsystem');
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
}
|
| 40 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Ticketsystem/Edit.php
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Ticketsystem_Edit extends Mage_Core_Block_Template
|
| 25 |
+
{
|
| 26 |
+
|
| 27 |
+
protected function _prepareLayout()
|
| 28 |
+
{
|
| 29 |
+
return parent::_prepareLayout();
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
public function getName(){
|
| 33 |
+
$session = Mage::getSingleton('customer/session');
|
| 34 |
+
if ($session){
|
| 35 |
+
$customerId= $session->getCustomerId();
|
| 36 |
+
if ($customerId>0){
|
| 37 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
| 38 |
+
return $customer->getName();
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
return '';
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
public function getEmail(){
|
| 45 |
+
$session = Mage::getSingleton('customer/session');
|
| 46 |
+
if ($session){
|
| 47 |
+
$customerId= $session->getCustomerId();
|
| 48 |
+
if ($customerId>0){
|
| 49 |
+
$customer = Mage::getModel('customer/customer')->load($customerId);
|
| 50 |
+
return $customer->getEmail();
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
return '';
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
public function getTicket($id){
|
| 57 |
+
if ($id>0)
|
| 58 |
+
return Mage::helper('ticketsystem')->getTicket($id);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
public function getDepartments(){
|
| 62 |
+
return Mage::helper('ticketsystem')->getAllCategories(false);
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
public function getDepartment($id){
|
| 67 |
+
return Mage::helper('ticketsystem')->getCategory($id);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
public function getMessage($ticketId){
|
| 71 |
+
|
| 72 |
+
//$reps=Mage::helper('ticketsystem')->getAllRepresantatives(true);
|
| 73 |
+
$answers='';
|
| 74 |
+
$model_ans = Mage::getModel('ticketsystem/answers');
|
| 75 |
+
foreach ($model_ans->getCollection()->addFieldToFilter('ticket',$ticketId)->load() as $item){
|
| 76 |
+
$message=$item->getData('message');
|
| 77 |
+
//$rep=$item->getData('rep');
|
| 78 |
+
$timestamp=$item->getData('timestamp');
|
| 79 |
+
$represantative='';
|
| 80 |
+
$answers .='('.$timestamp.') '.$message."<br>";
|
| 81 |
+
}
|
| 82 |
+
$model_msg = Mage::getModel('ticketsystem/messages')->load($ticketId, 'ticket');
|
| 83 |
+
$message = $model_msg->getMessage();
|
| 84 |
+
$timestamp= $model_msg->getTimestamp();
|
| 85 |
+
|
| 86 |
+
$message ='('.$timestamp.') '.$message."<br>";
|
| 87 |
+
|
| 88 |
+
if ($answers)
|
| 89 |
+
$message = $message."<br>".$answers;
|
| 90 |
+
// **********************************************
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
if ($message)
|
| 94 |
+
return $message;
|
| 95 |
+
return '';
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
public function getPriorities(){
|
| 99 |
+
return Mage::helper('ticketsystem')->getPriorities();
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
public function getPriority($priority){
|
| 103 |
+
$priorites= Mage::helper('ticketsystem')->getPriorities();
|
| 104 |
+
return $priorites[$priority];
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
public function getTitle($id)
|
| 108 |
+
{
|
| 109 |
+
if ($title = $this->getData('title')) {
|
| 110 |
+
return $title;
|
| 111 |
+
}
|
| 112 |
+
if ($id)
|
| 113 |
+
return Mage::helper('ticketsystem')->__('Edit Ticket');
|
| 114 |
+
return Mage::helper('ticketsystem')->__('Add Ticket');
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
public function getBackUrl()
|
| 118 |
+
{
|
| 119 |
+
if ($this->getData('back_url')) {
|
| 120 |
+
return $this->getData('back_url');
|
| 121 |
+
}
|
| 122 |
+
return $this->getUrl('ticketsystem/');
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
public function getSaveUrl($id)
|
| 126 |
+
{
|
| 127 |
+
if($id>0)
|
| 128 |
+
return Mage::getUrl('ticketsystem/index/editPost', array('_secure'=>true, 'id'=>$id));
|
| 129 |
+
return Mage::getUrl('ticketsystem/index/addPost', array('_secure'=>true));
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Ticketsystem/Navigation.php
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class MageTracking_TicketSystem_Block_Ticketsystem_Navigation extends Mage_Customer_Block_Account_Navigation
|
| 6 |
+
{
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
}
|
app/code/community/MageTracking/TicketSystem/Block/Ticketsystem/View.php
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class MageTracking_TicketSystem_Block_Ticketsystem_View extends Mage_Core_Block_Template
|
| 25 |
+
{
|
| 26 |
+
protected function _prepareLayout(){
|
| 27 |
+
$this->getLayout()->getBlock('head')->setTitle(Mage::helper('ticketsystem')->__('Ticket'));
|
| 28 |
+
return parent::_prepareLayout();
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function getTickets(){
|
| 32 |
+
return Mage::registry('ticketsystem_all');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
public function getDepartments(){
|
| 36 |
+
return Mage::helper('ticketsystem')->getAllCategories(false);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
public function getDepartment($id){
|
| 40 |
+
return Mage::helper('ticketsystem')->getCategory($id);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
public function getPriority($priority){
|
| 44 |
+
$priorites= Mage::helper('ticketsystem')->getPriorities();
|
| 45 |
+
return $priorites[$priority];
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
public function getStatus($status){
|
| 49 |
+
$statuses = Mage::getSingleton('ticketsystem/status')->getOptionArray();
|
| 50 |
+
return $statuses[$status];
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
}
|
app/code/community/MageTracking/TicketSystem/Helper/Data.php
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Sofhere SofTicket Magento Component
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the GNU (3.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/gpl-3.0.html
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category design_default
|
| 17 |
+
* @author sofhere.com
|
| 18 |
+
* @package Sofhere_SofTicket
|
| 19 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 20 |
+
* @version beta
|
| 21 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class MageTracking_TicketSystem_Helper_Data extends Mage_Core_Helper_Abstract
|
| 26 |
+
{
|
| 27 |
+
|
| 28 |
+
public function getPriorities(){
|
| 29 |
+
return array(1=>$this->__('Low'), 2=>$this->__('Medium'), 3=>$this->__('High'));
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
public function isAdmin(){
|
| 33 |
+
$user=Mage::getSingleton('admin/session')->getUser();
|
| 34 |
+
$userId=$user->getUserId();
|
| 35 |
+
$roleId = implode('', $user->getRoles());
|
| 36 |
+
$roleName = Mage::getModel('admin/roles')->load($roleId)->getRoleName();
|
| 37 |
+
if ($roleName == 'Administrators')
|
| 38 |
+
return true;
|
| 39 |
+
return false;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
public function getMailDBSettings(){
|
| 43 |
+
$array = array();
|
| 44 |
+
$model = Mage::getModel('ticketsystem/mail');
|
| 45 |
+
if ($model){
|
| 46 |
+
foreach($model->getCollection()->load() as $_item) {
|
| 47 |
+
$key=$_item->getData('key');
|
| 48 |
+
$value=$_item->getData('value');
|
| 49 |
+
$array[$key]= $value;
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
return $array;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
public function getAllCategories($admin=true){
|
| 57 |
+
|
| 58 |
+
$model_cats = Mage::getModel('ticketsystem/cats');
|
| 59 |
+
$cats = array();
|
| 60 |
+
foreach ($model_cats->getCollection()->load() as $item){
|
| 61 |
+
$hidden=$item->getData('hidden');
|
| 62 |
+
if (! ($admin ==false && $hidden =='1')){
|
| 63 |
+
$key=$item->getData('ID');
|
| 64 |
+
$cats[$key]= $item;
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
return $cats;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
public function getCategory($catID){
|
| 71 |
+
$cats=$this->getAllCategories();
|
| 72 |
+
if ($catID >0 && $cats[$catID])
|
| 73 |
+
return $cats[$catID]->getName();
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
public function getMessage($id){
|
| 77 |
+
$model = Mage::getModel('ticketsystem/messages');
|
| 78 |
+
if ($id >0 && $model)
|
| 79 |
+
return $model->load($id);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
public function getTicket($id){
|
| 83 |
+
if ($id>0){
|
| 84 |
+
$softicketModel = Mage::getModel('ticketsystem/ticketsystem')->load($id);
|
| 85 |
+
return $softicketModel;
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
public function getTicketID() {
|
| 90 |
+
do {
|
| 91 |
+
mt_srand((double)microtime() *1000000);
|
| 92 |
+
$min = 100000;
|
| 93 |
+
$max = 999999;
|
| 94 |
+
$id = mt_rand($min, $max);
|
| 95 |
+
}while ($this->validID($id));
|
| 96 |
+
return $id;
|
| 97 |
+
}
|
| 98 |
+
function validID($id) {
|
| 99 |
+
$model= Mage::getModel('ticketsystem/ticketsystem');
|
| 100 |
+
return $model->load($id)->getData('ID');
|
| 101 |
+
}
|
| 102 |
+
}
|
app/code/community/MageTracking/TicketSystem/Helper/Mail.php
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Sofhere SofTicket Magento Component
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the GNU (3.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/gpl-3.0.html
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category design_default
|
| 17 |
+
* @author sofhere.com
|
| 18 |
+
* @package Sofhere_SofTicket
|
| 19 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 20 |
+
* @version 1.0
|
| 21 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
require 'TicketFunctions.php';
|
| 26 |
+
|
| 27 |
+
class Mail{
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
public function sendEmail($id, $subject, $name, $email, $cat, $pri, $message = '', $mailsubject, $mailmsg , $signature, $answer = false){
|
| 31 |
+
|
| 32 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 33 |
+
$vars = array();
|
| 34 |
+
$vars['ticket'] = $id;
|
| 35 |
+
$vars['subject'] = $subject;
|
| 36 |
+
if ($answer)
|
| 37 |
+
$vars['answer'] = $message;
|
| 38 |
+
else
|
| 39 |
+
$vars['message'] = $message;
|
| 40 |
+
$vars['name'] = $name;
|
| 41 |
+
$vars['email'] = $email;
|
| 42 |
+
$vars['category'] ='';
|
| 43 |
+
if ($cat && $cat->getData('name'))
|
| 44 |
+
$vars['category'] = $cat->getData('name');
|
| 45 |
+
|
| 46 |
+
// remove tags from the message.
|
| 47 |
+
$mailmsg = addRemoveTag($mailmsg, $db_settings);
|
| 48 |
+
|
| 49 |
+
// add signature to the message.
|
| 50 |
+
if ($signature)
|
| 51 |
+
$mailmsg = addSig($signature, $mailmsg, $db_settings);
|
| 52 |
+
else
|
| 53 |
+
$mailmsg = addSig('', $mailmsg, $db_settings);
|
| 54 |
+
|
| 55 |
+
// replace keyword with real values from db.
|
| 56 |
+
$mailsubject = keywords($mailsubject, $vars, $db_settings);
|
| 57 |
+
$text = keywords($mailmsg, $vars, $db_settings);
|
| 58 |
+
|
| 59 |
+
if ($html = getHTML($mailmsg, $vars, 'email-example.html', $db_settings)) {
|
| 60 |
+
$body = array();
|
| 61 |
+
$body['text'] = $text;
|
| 62 |
+
$body['html'] = $html;
|
| 63 |
+
} else {
|
| 64 |
+
$body = $text;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
if ($db_settings['ticket_response']) {
|
| 68 |
+
$from='';
|
| 69 |
+
if ($cat && $cat->getData('name') && $cat->getData('email'))
|
| 70 |
+
$from = '"' . $cat->getData('name') . '" <' . $cat->getData('email') . '>';
|
| 71 |
+
send_mail($email, $mailsubject, $body, $from, $pri, $db_settings);
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
function emailAlert($tid, $msgid = false, $subject = false, $message = false) { //alerts the alert_user (in mail) and cat reps
|
| 77 |
+
|
| 78 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 79 |
+
|
| 80 |
+
$tid = preg_replace('/\D+/', '', $tid); //sanitise
|
| 81 |
+
$msgid = preg_replace('/\D+/', '', $msgid); //sanitise
|
| 82 |
+
if (empty($tid)) {
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
$t = Mage::getModel('ticketsystem/ticketsystem')->load($tid);
|
| 86 |
+
$cat =Mage::getModel('ticketsystem/cats')->load($t->getData('cat'));
|
| 87 |
+
|
| 88 |
+
$m = Mage::getModel('ticketsystem/messages')->load($msgid);
|
| 89 |
+
$from = $db_settings['alert_email'];
|
| 90 |
+
$alert_subj = $db_settings['alert_subj'];
|
| 91 |
+
$repl_meth = $cat->getData('reply_method');
|
| 92 |
+
$alert_msg = $db_settings['alert_msg'];
|
| 93 |
+
/*if ($repl_meth['reply_method'] != 'url') {
|
| 94 |
+
$alert_msg.= '<br>Client Request:' . $m->getData('message');
|
| 95 |
+
}*/
|
| 96 |
+
$vars = array();
|
| 97 |
+
$vars['ticket'] = $t->getData('ID');
|
| 98 |
+
$vars['subject'] = $subject ? $subject : htmlspecialchars_decode($t->getData('subject'));
|
| 99 |
+
$vars['category'] = $cat->getData('name');
|
| 100 |
+
$vars['cat_name'] = $cat->getData('name');
|
| 101 |
+
$vars['name'] = $t->getData('name');
|
| 102 |
+
$vars['email'] = $t->getData('email');
|
| 103 |
+
$vars['status'] = $t->getData('status');
|
| 104 |
+
$vars['datetime'] = (empty($m)) ? '' : format_time('r', $m->getData('timestamp'));
|
| 105 |
+
$vars['message'] = $message ? $message : htmlspecialchars_decode($m->getData('message'));
|
| 106 |
+
$alert_subj = keywords($alert_subj, $vars, $db_settings);
|
| 107 |
+
$text = keywords($alert_msg, $vars, $db_settings);
|
| 108 |
+
|
| 109 |
+
if ($html = getHTML($alert_msg, $vars, 'email-example.html', $db_settings)) {
|
| 110 |
+
$body = array();
|
| 111 |
+
$body['text'] = $text;
|
| 112 |
+
$body['html'] = $html;
|
| 113 |
+
} else {
|
| 114 |
+
$body = $text;
|
| 115 |
+
}
|
| 116 |
+
foreach($this->getEmails($t->getData('cat')) as $to) {
|
| 117 |
+
if (!empty($to)) {
|
| 118 |
+
send_mail($to, $alert_subj, $body, $from, $t->getData('priority'), $db_settings);
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
function getEmails($catid) {
|
| 125 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 126 |
+
$cat_reps = array();
|
| 127 |
+
$reps = Mage::getModel('ticketsystem/reps')->getCollection();
|
| 128 |
+
foreach($reps as $rep) {
|
| 129 |
+
$user_group =Mage::getModel('ticketsystem/groups')->load($rep->getData('user_group'));
|
| 130 |
+
if ($user_group){
|
| 131 |
+
$cat_access = explode(':', $user_group->getData('cat_access'));
|
| 132 |
+
if (in_array($catid, $cat_access) || in_array('all', $cat_access)) {
|
| 133 |
+
$cat_reps[] = $rep;
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
$emails = array();
|
| 138 |
+
if (!empty($db_settings['alert_user'])) {
|
| 139 |
+
$emails = explode(';', $db_settings['alert_user']);
|
| 140 |
+
}
|
| 141 |
+
foreach($cat_reps as $cat_rep) {
|
| 142 |
+
$add_email = 1;
|
| 143 |
+
if (substr($rep->getData('password'), 0, 8) === '*LOCKED*') {
|
| 144 |
+
$add_email = 0;
|
| 145 |
+
}
|
| 146 |
+
if (in_array($cat_rep->getData('email'), $emails)) {
|
| 147 |
+
$add_email = 0;
|
| 148 |
+
}
|
| 149 |
+
if ($add_email) {
|
| 150 |
+
$emails[] = $cat_rep->getData('email');
|
| 151 |
+
}
|
| 152 |
+
}
|
| 153 |
+
$emails = array_unique($em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|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* Sofhere SofTicket Magento Component
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the GNU (3.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/gpl-3.0.html
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 13 |
+
* obtain it through the world-wide-web, please send an email
|
| 14 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 15 |
+
*
|
| 16 |
+
* @category design_default
|
| 17 |
+
* @author sofhere.com
|
| 18 |
+
* @package Sofhere_SofTicket
|
| 19 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 20 |
+
* @version 1.0
|
| 21 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 22 |
+
*/
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
require 'TicketFunctions.php';
|
| 26 |
+
|
| 27 |
+
class Mail_data{
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
public function sendEmail($id, $subject, $name, $email, $cat, $pri, $message = '', $mailsubject, $mailmsg , $signature, $answer = false){
|
| 31 |
+
|
| 32 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();//print_r($db_settings);die();
|
| 33 |
+
$vars = array();
|
| 34 |
+
$vars['ticket'] = $id;
|
| 35 |
+
$vars['subject'] = $subject;
|
| 36 |
+
if ($answer)
|
| 37 |
+
$vars['answer'] = $message;
|
| 38 |
+
else
|
| 39 |
+
$vars['message'] = $message;
|
| 40 |
+
$vars['name'] = $name;
|
| 41 |
+
$vars['email'] = $email;
|
| 42 |
+
$vars['category'] ='';
|
| 43 |
+
if ($cat && $cat->getData('name'))
|
| 44 |
+
$vars['category'] = $cat->getData('name');
|
| 45 |
+
|
| 46 |
+
// remove tags from the message.
|
| 47 |
+
$mailmsg = addRemoveTag($mailmsg, $db_settings);
|
| 48 |
+
|
| 49 |
+
// add signature to the message.
|
| 50 |
+
if ($signature)
|
| 51 |
+
$mailmsg = addSig($signature, $mailmsg, $db_settings);
|
| 52 |
+
else
|
| 53 |
+
$mailmsg = addSig('', $mailmsg, $db_settings);
|
| 54 |
+
|
| 55 |
+
// replace keyword with real values from db.
|
| 56 |
+
$mailsubject = keywords($mailsubject, $vars, $db_settings);
|
| 57 |
+
$text = keywords($mailmsg, $vars, $db_settings);
|
| 58 |
+
|
| 59 |
+
if ($html = getHTML($mailmsg, $vars, 'email-example.html', $db_settings)) {
|
| 60 |
+
$body = array();
|
| 61 |
+
$body['text'] = $text;
|
| 62 |
+
$body['html'] = $html;
|
| 63 |
+
} else {
|
| 64 |
+
$body = $text;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
if ($db_settings['ticket_response']) {
|
| 68 |
+
$from='';
|
| 69 |
+
if ($cat && $cat->getData('name') && $cat->getData('email'))
|
| 70 |
+
$from = '"' . $cat->getData('name') . '" <' . $cat->getData('email') . '>';
|
| 71 |
+
send_mail($email, $mailsubject, $body, $from, $pri, $db_settings);
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
function emailAlert($tid, $msgid = false, $subject = false, $message = false) { //alerts the alert_user (in mail) and cat reps
|
| 77 |
+
|
| 78 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 79 |
+
|
| 80 |
+
$tid = preg_replace('/\D+/', '', $tid); //sanitise
|
| 81 |
+
$msgid = preg_replace('/\D+/', '', $msgid); //sanitise
|
| 82 |
+
if (empty($tid)) {
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
$t = Mage::getModel('ticketsystem/ticketsystem')->load($tid);
|
| 86 |
+
$cat =Mage::getModel('ticketsystem/cats')->load($t->getData('cat'));
|
| 87 |
+
|
| 88 |
+
$m = Mage::getModel('ticketsystem/messages')->load($msgid);
|
| 89 |
+
$from = $db_settings['alert_email'];
|
| 90 |
+
$alert_subj = $db_settings['alert_subj'];
|
| 91 |
+
$repl_meth = $cat->getData('reply_method');
|
| 92 |
+
$alert_msg = $db_settings['alert_msg'];
|
| 93 |
+
/*if ($repl_meth['reply_method'] != 'url') {
|
| 94 |
+
$alert_msg.= '<br>Client Request:' . $m->getData('message');
|
| 95 |
+
}*/
|
| 96 |
+
$vars = array();
|
| 97 |
+
$vars['ticket'] = $t->getData('ID');
|
| 98 |
+
$vars['subject'] = $subject ? $subject : htmlspecialchars_decode($t->getData('subject'));
|
| 99 |
+
$vars['category'] = $cat->getData('name');
|
| 100 |
+
$vars['cat_name'] = $cat->getData('name');
|
| 101 |
+
$vars['name'] = $t->getData('name');
|
| 102 |
+
$vars['email'] = $t->getData('email');
|
| 103 |
+
$vars['status'] = $t->getData('status');
|
| 104 |
+
$vars['datetime'] = (empty($m)) ? '' : format_time('r', $m->getData('timestamp'));
|
| 105 |
+
$vars['message'] = $message ? $message : htmlspecialchars_decode($m->getData('message'));
|
| 106 |
+
$alert_subj = keywords($alert_subj, $vars, $db_settings);
|
| 107 |
+
$text = keywords($alert_msg, $vars, $db_settings);
|
| 108 |
+
|
| 109 |
+
if ($html = getHTML($alert_msg, $vars, 'email-example.html', $db_settings)) {
|
| 110 |
+
$body = array();
|
| 111 |
+
$body['text'] = $text;
|
| 112 |
+
$body['html'] = $html;
|
| 113 |
+
} else {
|
| 114 |
+
$body = $text;
|
| 115 |
+
}
|
| 116 |
+
foreach($this->getEmails($t->getData('cat')) as $to) {
|
| 117 |
+
if (!empty($to)) {
|
| 118 |
+
send_mail($to, $alert_subj, $body, $from, $t->getData('priority'), $db_settings);
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
function getEmails($catid) {
|
| 125 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 126 |
+
$cat_reps = array();
|
| 127 |
+
|
| 128 |
+
$emails = array();
|
| 129 |
+
if (!empty($db_settings['alert_user'])) {
|
| 130 |
+
$emails = explode(';', $db_settings['alert_user']);
|
| 131 |
+
}
|
| 132 |
+
foreach($cat_reps as $cat_rep) {
|
| 133 |
+
$add_email = 1;
|
| 134 |
+
if (substr($rep->getData('password'), 0, 8) === '*LOCKED*') {
|
| 135 |
+
$add_email = 0;
|
| 136 |
+
}
|
| 137 |
+
if (in_array($cat_rep->getData('email'), $emails)) {
|
| 138 |
+
$add_email = 0;
|
| 139 |
+
}
|
| 140 |
+
if ($add_email) {
|
| 141 |
+
$emails[] = $cat_rep->getData('email');
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
$emails = array_unique($emails);
|
| 145 |
+
return $emails;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
}
|
| 150 |
+
?>
|
app/code/community/MageTracking/TicketSystem/Helper/Phpmailer.php
ADDED
|
@@ -0,0 +1,1897 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/*~ class.phpmailer.php
|
| 3 |
+
.---------------------------------------------------------------------------.
|
| 4 |
+
| Software: PHPMailer - PHP email class |
|
| 5 |
+
| Version: 2.2.1 |
|
| 6 |
+
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
|
| 7 |
+
| Info: http://phpmailer.sourceforge.net |
|
| 8 |
+
| Support: http://sourceforge.net/projects/phpmailer/ |
|
| 9 |
+
| ------------------------------------------------------------------------- |
|
| 10 |
+
| Author: Andy Prevost (project admininistrator) |
|
| 11 |
+
| Author: Brent R. Matzelle (original founder) |
|
| 12 |
+
| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
|
| 13 |
+
| Copyright (c) 2001-2003, Brent R. Matzelle |
|
| 14 |
+
| ------------------------------------------------------------------------- |
|
| 15 |
+
| License: Distributed under the Lesser General Public License (LGPL) |
|
| 16 |
+
| http://www.gnu.org/copyleft/lesser.html |
|
| 17 |
+
| This program is distributed in the hope that it will be useful - WITHOUT |
|
| 18 |
+
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
| 19 |
+
| FITNESS FOR A PARTICULAR PURPOSE. |
|
| 20 |
+
| ------------------------------------------------------------------------- |
|
| 21 |
+
| We offer a number of paid services (www.codeworxtech.com): |
|
| 22 |
+
| - Web Hosting on highly optimized fast and secure servers |
|
| 23 |
+
| - Technology Consulting |
|
| 24 |
+
| - Oursourcing (highly qualified programmers and graphic designers) |
|
| 25 |
+
'---------------------------------------------------------------------------'
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* PHPMailer - PHP email transport class
|
| 29 |
+
* NOTE: Designed for use with PHP version 5 and up
|
| 30 |
+
* @package PHPMailer
|
| 31 |
+
* @author Andy Prevost
|
| 32 |
+
* @copyright 2004 - 2008 Andy Prevost
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
class PHPMailer {
|
| 36 |
+
|
| 37 |
+
/////////////////////////////////////////////////
|
| 38 |
+
// PROPERTIES, PUBLIC
|
| 39 |
+
/////////////////////////////////////////////////
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Email priority (1 = High, 3 = Normal, 5 = low).
|
| 43 |
+
* @var int
|
| 44 |
+
*/
|
| 45 |
+
public $Priority = 3;
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Sets the CharSet of the message.
|
| 49 |
+
* @var string
|
| 50 |
+
*/
|
| 51 |
+
public $CharSet = 'iso-8859-1';
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Sets the Content-type of the message.
|
| 55 |
+
* @var string
|
| 56 |
+
*/
|
| 57 |
+
public $ContentType = 'text/plain';
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Sets the Encoding of the message. Options for this are "8bit",
|
| 61 |
+
* "7bit", "binary", "base64", and "quoted-printable".
|
| 62 |
+
* @var string
|
| 63 |
+
*/
|
| 64 |
+
public $Encoding = '8bit';
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* Holds the most recent mailer error message.
|
| 68 |
+
* @var string
|
| 69 |
+
*/
|
| 70 |
+
public $ErrorInfo = '';
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Sets the From email address for the message.
|
| 74 |
+
* @var string
|
| 75 |
+
*/
|
| 76 |
+
public $From = 'root@localhost';
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Sets the From name of the message.
|
| 80 |
+
* @var string
|
| 81 |
+
*/
|
| 82 |
+
public $FromName = 'Root User';
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Sets the Sender email (Return-Path) of the message. If not empty,
|
| 86 |
+
* will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
|
| 87 |
+
* @var string
|
| 88 |
+
*/
|
| 89 |
+
public $Sender = '';
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* Sets the Subject of the message.
|
| 93 |
+
* @var string
|
| 94 |
+
*/
|
| 95 |
+
public $Subject = '';
|
| 96 |
+
|
| 97 |
+
/**
|
| 98 |
+
* Sets the Body of the message. This can be either an HTML or text body.
|
| 99 |
+
* If HTML then run IsHTML(true).
|
| 100 |
+
* @var string
|
| 101 |
+
*/
|
| 102 |
+
public $Body = '';
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* Sets the text-only body of the message. This automatically sets the
|
| 106 |
+
* email to multipart/alternative. This body can be read by mail
|
| 107 |
+
* clients that do not have HTML email capability such as mutt. Clients
|
| 108 |
+
* that can read HTML will view the normal Body.
|
| 109 |
+
* @var string
|
| 110 |
+
*/
|
| 111 |
+
public $AltBody = '';
|
| 112 |
+
|
| 113 |
+
/**
|
| 114 |
+
* Sets word wrapping on the body of the message to a given number of
|
| 115 |
+
* characters.
|
| 116 |
+
* @var int
|
| 117 |
+
*/
|
| 118 |
+
public $WordWrap = 0;
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
* Method to send mail: ("mail", "sendmail", or "smtp").
|
| 122 |
+
* @var string
|
| 123 |
+
*/
|
| 124 |
+
public $Mailer = 'mail';
|
| 125 |
+
|
| 126 |
+
/**
|
| 127 |
+
* Sets the path of the sendmail program.
|
| 128 |
+
* @var string
|
| 129 |
+
*/
|
| 130 |
+
public $Sendmail = '/usr/sbin/sendmail';
|
| 131 |
+
|
| 132 |
+
/**
|
| 133 |
+
* Path to PHPMailer plugins. This is now only useful if the SMTP class
|
| 134 |
+
* is in a different directory than the PHP include path.
|
| 135 |
+
* @var string
|
| 136 |
+
*/
|
| 137 |
+
public $PluginDir = '';
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Holds PHPMailer version.
|
| 141 |
+
* @var string
|
| 142 |
+
*/
|
| 143 |
+
public $Version = "2.2";
|
| 144 |
+
|
| 145 |
+
/**
|
| 146 |
+
* Sets the email address that a reading confirmation will be sent.
|
| 147 |
+
* @var string
|
| 148 |
+
*/
|
| 149 |
+
public $ConfirmReadingTo = '';
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Sets the hostname to use in Message-Id and Received headers
|
| 153 |
+
* and as default HELO string. If empty, the value returned
|
| 154 |
+
* by SERVER_NAME is used or 'localhost.localdomain'.
|
| 155 |
+
* @var string
|
| 156 |
+
*/
|
| 157 |
+
public $Hostname = '';
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* Sets the message ID to be used in the Message-Id header.
|
| 161 |
+
* If empty, a unique id will be generated.
|
| 162 |
+
* @var string
|
| 163 |
+
*/
|
| 164 |
+
public $MessageID = '';
|
| 165 |
+
|
| 166 |
+
/////////////////////////////////////////////////
|
| 167 |
+
// PROPERTIES FOR SMTP
|
| 168 |
+
/////////////////////////////////////////////////
|
| 169 |
+
|
| 170 |
+
/**
|
| 171 |
+
* Sets the SMTP hosts. All hosts must be separated by a
|
| 172 |
+
* semicolon. You can also specify a different port
|
| 173 |
+
* for each host by using this format: [hostname:port]
|
| 174 |
+
* (e.g. "smtp1.example.com:25;smtp2.example.com").
|
| 175 |
+
* Hosts will be tried in order.
|
| 176 |
+
* @var string
|
| 177 |
+
*/
|
| 178 |
+
public $Host = 'localhost';
|
| 179 |
+
|
| 180 |
+
/**
|
| 181 |
+
* Sets the default SMTP server port.
|
| 182 |
+
* @var int
|
| 183 |
+
*/
|
| 184 |
+
public $Port = 25;
|
| 185 |
+
|
| 186 |
+
/**
|
| 187 |
+
* Sets the SMTP HELO of the message (Default is $Hostname).
|
| 188 |
+
* @var string
|
| 189 |
+
*/
|
| 190 |
+
public $Helo = '';
|
| 191 |
+
|
| 192 |
+
/**
|
| 193 |
+
* Sets connection prefix.
|
| 194 |
+
* Options are "", "ssl" or "tls"
|
| 195 |
+
* @var string
|
| 196 |
+
*/
|
| 197 |
+
public $SMTPSecure = "";
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* Sets SMTP authentication. Utilizes the Username and Password variables.
|
| 201 |
+
* @var bool
|
| 202 |
+
*/
|
| 203 |
+
public $SMTPAuth = false;
|
| 204 |
+
|
| 205 |
+
/**
|
| 206 |
+
* Sets SMTP username.
|
| 207 |
+
* @var string
|
| 208 |
+
*/
|
| 209 |
+
public $Username = '';
|
| 210 |
+
|
| 211 |
+
/**
|
| 212 |
+
* Sets SMTP password.
|
| 213 |
+
* @var string
|
| 214 |
+
*/
|
| 215 |
+
public $Password = '';
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* Sets the SMTP server timeout in seconds. This function will not
|
| 219 |
+
* work with the win32 version.
|
| 220 |
+
* @var int
|
| 221 |
+
*/
|
| 222 |
+
public $Timeout = 10;
|
| 223 |
+
|
| 224 |
+
/**
|
| 225 |
+
* Sets SMTP class debugging on or off.
|
| 226 |
+
* @var bool
|
| 227 |
+
*/
|
| 228 |
+
public $SMTPDebug = false;
|
| 229 |
+
|
| 230 |
+
/**
|
| 231 |
+
* Prevents the SMTP connection from being closed after each mail
|
| 232 |
+
* sending. If this is set to true then to close the connection
|
| 233 |
+
* requires an explicit call to SmtpClose().
|
| 234 |
+
* @var bool
|
| 235 |
+
*/
|
| 236 |
+
public $SMTPKeepAlive = false;
|
| 237 |
+
|
| 238 |
+
/**
|
| 239 |
+
* Provides the ability to have the TO field process individual
|
| 240 |
+
* emails, instead of sending to entire TO addresses
|
| 241 |
+
* @var bool
|
| 242 |
+
*/
|
| 243 |
+
public $SingleTo = false;
|
| 244 |
+
|
| 245 |
+
/////////////////////////////////////////////////
|
| 246 |
+
// PROPERTIES, PRIVATE
|
| 247 |
+
/////////////////////////////////////////////////
|
| 248 |
+
|
| 249 |
+
private $smtp = NULL;
|
| 250 |
+
private $to = array();
|
| 251 |
+
private $cc = array();
|
| 252 |
+
private $bcc = array();
|
| 253 |
+
private $ReplyTo = array();
|
| 254 |
+
private $attachment = array();
|
| 255 |
+
private $CustomHeader = array();
|
| 256 |
+
private $message_type = '';
|
| 257 |
+
private $boundary = array();
|
| 258 |
+
private $language = array();
|
| 259 |
+
private $error_count = 0;
|
| 260 |
+
private $LE = "\n";
|
| 261 |
+
private $sign_cert_file = "";
|
| 262 |
+
private $sign_key_file = "";
|
| 263 |
+
private $sign_key_pass = "";
|
| 264 |
+
|
| 265 |
+
/////////////////////////////////////////////////
|
| 266 |
+
// METHODS, VARIABLES
|
| 267 |
+
/////////////////////////////////////////////////
|
| 268 |
+
|
| 269 |
+
/**
|
| 270 |
+
* Sets message type to HTML.
|
| 271 |
+
* @param bool $bool
|
| 272 |
+
* @return void
|
| 273 |
+
*/
|
| 274 |
+
public function IsHTML($bool) {
|
| 275 |
+
if($bool == true) {
|
| 276 |
+
$this->ContentType = 'text/html';
|
| 277 |
+
} else {
|
| 278 |
+
$this->ContentType = 'text/plain';
|
| 279 |
+
}
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
/**
|
| 283 |
+
* Sets Mailer to send message using SMTP.
|
| 284 |
+
* @return void
|
| 285 |
+
*/
|
| 286 |
+
public function IsSMTP() {echo "1";die();
|
| 287 |
+
$this->Mailer = 'smtp';
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
/**
|
| 291 |
+
* Sets Mailer to send message using PHP mail() function.
|
| 292 |
+
* @return void
|
| 293 |
+
*/
|
| 294 |
+
public function IsMail() {//echo "2";die();
|
| 295 |
+
$this->Mailer = 'mail';
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
/**
|
| 299 |
+
* Sets Mailer to send message using the $Sendmail program.
|
| 300 |
+
* @return void
|
| 301 |
+
*/
|
| 302 |
+
public function IsSendmail() {echo "3";die();
|
| 303 |
+
$this->Mailer = 'sendmail';
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
/**
|
| 307 |
+
* Sets Mailer to send message using the qmail MTA.
|
| 308 |
+
* @return void
|
| 309 |
+
*/
|
| 310 |
+
public function IsQmail() {echo "4";die();
|
| 311 |
+
$this->Sendmail = '/var/qmail/bin/sendmail';
|
| 312 |
+
$this->Mailer = 'sendmail';
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
/////////////////////////////////////////////////
|
| 316 |
+
// METHODS, RECIPIENTS
|
| 317 |
+
/////////////////////////////////////////////////
|
| 318 |
+
|
| 319 |
+
/**
|
| 320 |
+
* Adds a "To" address.
|
| 321 |
+
* @param string $address
|
| 322 |
+
* @param string $name
|
| 323 |
+
* @return void
|
| 324 |
+
*/
|
| 325 |
+
public function AddAddress($address, $name = '') {
|
| 326 |
+
$cur = count($this->to);
|
| 327 |
+
$this->to[$cur][0] = trim($address);
|
| 328 |
+
$this->to[$cur][1] = $name;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
/**
|
| 332 |
+
* Adds a "Cc" address. Note: this function works
|
| 333 |
+
* with the SMTP mailer on win32, not with the "mail"
|
| 334 |
+
* mailer.
|
| 335 |
+
* @param string $address
|
| 336 |
+
* @param string $name
|
| 337 |
+
* @return void
|
| 338 |
+
*/
|
| 339 |
+
public function AddCC($address, $name = '') {
|
| 340 |
+
$cur = count($this->cc);
|
| 341 |
+
$this->cc[$cur][0] = trim($address);
|
| 342 |
+
$this->cc[$cur][1] = $name;
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
/**
|
| 346 |
+
* Adds a "Bcc" address. Note: this function works
|
| 347 |
+
* with the SMTP mailer on win32, not with the "mail"
|
| 348 |
+
* mailer.
|
| 349 |
+
* @param string $address
|
| 350 |
+
* @param string $name
|
| 351 |
+
* @return void
|
| 352 |
+
*/
|
| 353 |
+
public function AddBCC($address, $name = '') {
|
| 354 |
+
$cur = count($this->bcc);
|
| 355 |
+
$this->bcc[$cur][0] = trim($address);
|
| 356 |
+
$this->bcc[$cur][1] = $name;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
/**
|
| 360 |
+
* Adds a "Reply-to" address.
|
| 361 |
+
* @param string $address
|
| 362 |
+
* @param string $name
|
| 363 |
+
* @return void
|
| 364 |
+
*/
|
| 365 |
+
public function AddReplyTo($address, $name = '') {
|
| 366 |
+
$cur = count($this->ReplyTo);
|
| 367 |
+
$this->ReplyTo[$cur][0] = trim($address);
|
| 368 |
+
$this->ReplyTo[$cur][1] = $name;
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
/////////////////////////////////////////////////
|
| 372 |
+
// METHODS, MAIL SENDING
|
| 373 |
+
/////////////////////////////////////////////////
|
| 374 |
+
|
| 375 |
+
/**
|
| 376 |
+
* Creates message and assigns Mailer. If the message is
|
| 377 |
+
* not sent successfully then it returns false. Use the ErrorInfo
|
| 378 |
+
* variable to view description of the error.
|
| 379 |
+
* @return bool
|
| 380 |
+
*/
|
| 381 |
+
public function Send() {
|
| 382 |
+
$header = '';
|
| 383 |
+
$body = '';
|
| 384 |
+
$result = true;
|
| 385 |
+
|
| 386 |
+
if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
|
| 387 |
+
$this->SetError($this->Lang('provide_address'));
|
| 388 |
+
return false;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
/* Set whether the message is multipart/alternative */
|
| 392 |
+
if(!empty($this->AltBody)) {
|
| 393 |
+
$this->ContentType = 'multipart/alternative';
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
$this->error_count = 0; // reset errors
|
| 397 |
+
$this->SetMessageType();
|
| 398 |
+
$header .= $this->CreateHeader();
|
| 399 |
+
$body = $this->CreateBody();
|
| 400 |
+
|
| 401 |
+
if($body == '') {
|
| 402 |
+
return false;
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
/* Choose the mailer */
|
| 406 |
+
switch($this->Mailer) {
|
| 407 |
+
case 'sendmail':
|
| 408 |
+
$result = $this->SendmailSend($header, $body);
|
| 409 |
+
break;
|
| 410 |
+
case 'smtp':
|
| 411 |
+
$result = $this->SmtpSend($header, $body);
|
| 412 |
+
break;
|
| 413 |
+
case 'mail':
|
| 414 |
+
$result = $this->MailSend($header, $body);
|
| 415 |
+
break;
|
| 416 |
+
default:
|
| 417 |
+
$result = $this->MailSend($header, $body);
|
| 418 |
+
break;
|
| 419 |
+
//$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
|
| 420 |
+
//$result = false;
|
| 421 |
+
//break;
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
return $result;
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
/**
|
| 428 |
+
* Sends mail using the $Sendmail program.
|
| 429 |
+
* @access public
|
| 430 |
+
* @return bool
|
| 431 |
+
*/
|
| 432 |
+
public function SendmailSend($header, $body) {
|
| 433 |
+
if ($this->Sender != '') {
|
| 434 |
+
$sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
|
| 435 |
+
} else {
|
| 436 |
+
$sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
if(!@$mail = popen($sendmail, 'w')) {
|
| 440 |
+
$this->SetError($this->Lang('execute') . $this->Sendmail);
|
| 441 |
+
return false;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
fputs($mail, $header);
|
| 445 |
+
fputs($mail, $body);
|
| 446 |
+
|
| 447 |
+
$result = pclose($mail);
|
| 448 |
+
if (version_compare(phpversion(), '4.2.3') == -1) {
|
| 449 |
+
$result = $result >> 8 & 0xFF;
|
| 450 |
+
}
|
| 451 |
+
if($result != 0) {
|
| 452 |
+
$this->SetError($this->Lang('execute') . $this->Sendmail);
|
| 453 |
+
return false;
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
return true;
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
/**
|
| 460 |
+
* Sends mail using the PHP mail() function.
|
| 461 |
+
* @access public
|
| 462 |
+
* @return bool
|
| 463 |
+
*/
|
| 464 |
+
public function MailSend($header, $body) {
|
| 465 |
+
|
| 466 |
+
$to = '';
|
| 467 |
+
for($i = 0; $i < count($this->to); $i++) {
|
| 468 |
+
if($i != 0) { $to .= ', '; }
|
| 469 |
+
$to .= $this->AddrFormat($this->to[$i]);
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
$toArr = split(',', $to);
|
| 473 |
+
|
| 474 |
+
$params = sprintf("-oi -f %s", $this->Sender);
|
| 475 |
+
if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
|
| 476 |
+
$old_from = ini_get('sendmail_from');
|
| 477 |
+
ini_set('sendmail_from', $this->Sender);
|
| 478 |
+
if ($this->SingleTo === true && count($toArr) > 1) {
|
| 479 |
+
foreach ($toArr as $key => $val) {
|
| 480 |
+
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
|
| 481 |
+
}
|
| 482 |
+
} else {
|
| 483 |
+
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
|
| 484 |
+
}
|
| 485 |
+
} else {
|
| 486 |
+
if ($this->SingleTo === true && count($toArr) > 1) {
|
| 487 |
+
foreach ($toArr as $key => $val) {
|
| 488 |
+
$rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
|
| 489 |
+
}
|
| 490 |
+
} else {
|
| 491 |
+
$rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
if (isset($old_from)) {
|
| 496 |
+
ini_set('sendmail_from', $old_from);
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
if(!$rt) {
|
| 500 |
+
$this->SetError($this->Lang('instantiate'));
|
| 501 |
+
return false;
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
return true;
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
/**
|
| 508 |
+
* Sends mail via SMTP using PhpSMTP (Author:
|
| 509 |
+
* Chris Ryan). Returns bool. Returns false if there is a
|
| 510 |
+
* bad MAIL FROM, RCPT, or DATA input.
|
| 511 |
+
* @access public
|
| 512 |
+
* @return bool
|
| 513 |
+
*/
|
| 514 |
+
public function SmtpSend($header, $body) {echo "here4";die();
|
| 515 |
+
include_once($this->PluginDir . 'Smtp.php');
|
| 516 |
+
$error = '';
|
| 517 |
+
$bad_rcpt = array();
|
| 518 |
+
|
| 519 |
+
if(!$this->SmtpConnect()) {
|
| 520 |
+
return false;
|
| 521 |
+
}
|
| 522 |
+
|
| 523 |
+
$smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
|
| 524 |
+
if(!$this->smtp->Mail($smtp_from)) {
|
| 525 |
+
$error = $this->Lang('from_failed') . $smtp_from;
|
| 526 |
+
$this->SetError($error);
|
| 527 |
+
$this->smtp->Reset();
|
| 528 |
+
return false;
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
/* Attempt to send attach all recipients */
|
| 532 |
+
for($i = 0; $i < count($this->to); $i++) {
|
| 533 |
+
if(!$this->smtp->Recipient($this->to[$i][0])) {
|
| 534 |
+
$bad_rcpt[] = $this->to[$i][0];
|
| 535 |
+
}
|
| 536 |
+
}
|
| 537 |
+
for($i = 0; $i < count($this->cc); $i++) {
|
| 538 |
+
if(!$this->smtp->Recipient($this->cc[$i][0])) {
|
| 539 |
+
$bad_rcpt[] = $this->cc[$i][0];
|
| 540 |
+
}
|
| 541 |
+
}
|
| 542 |
+
for($i = 0; $i < count($this->bcc); $i++) {
|
| 543 |
+
if(!$this->smtp->Recipient($this->bcc[$i][0])) {
|
| 544 |
+
$bad_rcpt[] = $this->bcc[$i][0];
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
if(count($bad_rcpt) > 0) { // Create error message
|
| 549 |
+
for($i = 0; $i < count($bad_rcpt); $i++) {
|
| 550 |
+
if($i != 0) {
|
| 551 |
+
$error .= ', ';
|
| 552 |
+
}
|
| 553 |
+
$error .= $bad_rcpt[$i];
|
| 554 |
+
}
|
| 555 |
+
$error = $this->Lang('recipients_failed') . $error;
|
| 556 |
+
$this->SetError($error);
|
| 557 |
+
$this->smtp->Reset();
|
| 558 |
+
return false;
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
if(!$this->smtp->Data($header . $body)) {
|
| 562 |
+
$this->SetError($this->Lang('data_not_accepted'));
|
| 563 |
+
$this->smtp->Reset();
|
| 564 |
+
return false;
|
| 565 |
+
}
|
| 566 |
+
if($this->SMTPKeepAlive == true) {
|
| 567 |
+
$this->smtp->Reset();
|
| 568 |
+
} else {
|
| 569 |
+
$this->SmtpClose();
|
| 570 |
+
}
|
| 571 |
+
|
| 572 |
+
return true;
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
/**
|
| 576 |
+
* Initiates a connection to an SMTP server. Returns false if the
|
| 577 |
+
* operation failed.
|
| 578 |
+
* @access public
|
| 579 |
+
* @return bool
|
| 580 |
+
*/
|
| 581 |
+
public function SmtpConnect() {echo "here5";die();
|
| 582 |
+
if($this->smtp == NULL) {
|
| 583 |
+
$this->smtp = new SMTP();
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
$this->smtp->do_debug = $this->SMTPDebug;
|
| 587 |
+
$hosts = explode(';', $this->Host);
|
| 588 |
+
$index = 0;
|
| 589 |
+
$connection = ($this->smtp->Connected());
|
| 590 |
+
|
| 591 |
+
/* Retry while there is no connection */
|
| 592 |
+
while($index < count($hosts) && $connection == false) {
|
| 593 |
+
$hostinfo = array();
|
| 594 |
+
if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
|
| 595 |
+
$host = $hostinfo[1];
|
| 596 |
+
$port = $hostinfo[2];
|
| 597 |
+
} else {
|
| 598 |
+
$host = $hosts[$index];
|
| 599 |
+
$port = $this->Port;
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
$tls = ($this->SMTPSecure == 'tls');
|
| 603 |
+
$ssl = ($this->SMTPSecure == 'ssl');
|
| 604 |
+
|
| 605 |
+
if($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
|
| 606 |
+
|
| 607 |
+
$hello = ($this->Helo != '' ? $this->Hello : $this->ServerHostname());
|
| 608 |
+
$this->smtp->Hello($hello);
|
| 609 |
+
|
| 610 |
+
if($tls) {
|
| 611 |
+
if(!$this->smtp->StartTLS()) {
|
| 612 |
+
$this->SetError($this->Lang("tls"));
|
| 613 |
+
$this->smtp->Reset();
|
| 614 |
+
$connection = false;
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
//We must resend HELLO after tls negociation
|
| 618 |
+
$this->smtp->Hello($hello);
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
$connection = true;
|
| 622 |
+
if($this->SMTPAuth) {
|
| 623 |
+
if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
|
| 624 |
+
$this->SetError($this->Lang('authenticate'));
|
| 625 |
+
$this->smtp->Reset();
|
| 626 |
+
$connection = false;
|
| 627 |
+
}
|
| 628 |
+
}
|
| 629 |
+
}
|
| 630 |
+
$index++;
|
| 631 |
+
}
|
| 632 |
+
if(!$connection) {
|
| 633 |
+
$this->SetError($this->Lang('connect_host'));
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
return $connection;
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
/**
|
| 640 |
+
* Closes the active SMTP session if one exists.
|
| 641 |
+
* @return void
|
| 642 |
+
*/
|
| 643 |
+
public function SmtpClose() {
|
| 644 |
+
if($this->smtp != NULL) {
|
| 645 |
+
if($this->smtp->Connected()) {
|
| 646 |
+
$this->smtp->Quit();
|
| 647 |
+
$this->smtp->Close();
|
| 648 |
+
}
|
| 649 |
+
}
|
| 650 |
+
}
|
| 651 |
+
|
| 652 |
+
/**
|
| 653 |
+
* Sets the language for all class error messages. Returns false
|
| 654 |
+
* if it cannot load the language file. The default language type
|
| 655 |
+
* is English.
|
| 656 |
+
* @param string $lang_type Type of language (e.g. Portuguese: "br")
|
| 657 |
+
* @param string $lang_path Path to the language file directory
|
| 658 |
+
* @access public
|
| 659 |
+
* @return bool
|
| 660 |
+
*/
|
| 661 |
+
function SetLanguage($lang_type = 'en', $lang_path = 'language/') {
|
| 662 |
+
if( !(@include $lang_path.'phpmailer.lang-'.$lang_type.'.php') ) {
|
| 663 |
+
$this->SetError('Could not load language file');
|
| 664 |
+
return false;
|
| 665 |
+
}
|
| 666 |
+
$this->language = $PHPMAILER_LANG;
|
| 667 |
+
return true;
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
/////////////////////////////////////////////////
|
| 671 |
+
// METHODS, MESSAGE CREATION
|
| 672 |
+
/////////////////////////////////////////////////
|
| 673 |
+
|
| 674 |
+
/**
|
| 675 |
+
* Creates recipient headers.
|
| 676 |
+
* @access public
|
| 677 |
+
* @return string
|
| 678 |
+
*/
|
| 679 |
+
public function AddrAppend($type, $addr) {
|
| 680 |
+
$addr_str = $type . ': ';
|
| 681 |
+
$addr_str .= $this->AddrFormat($addr[0]);
|
| 682 |
+
if(count($addr) > 1) {
|
| 683 |
+
for($i = 1; $i < count($addr); $i++) {
|
| 684 |
+
$addr_str .= ', ' . $this->AddrFormat($addr[$i]);
|
| 685 |
+
}
|
| 686 |
+
}
|
| 687 |
+
$addr_str .= $this->LE;
|
| 688 |
+
|
| 689 |
+
return $addr_str;
|
| 690 |
+
}
|
| 691 |
+
|
| 692 |
+
/**
|
| 693 |
+
* Formats an address correctly.
|
| 694 |
+
* @access public
|
| 695 |
+
* @return string
|
| 696 |
+
*/
|
| 697 |
+
public function AddrFormat($addr) {
|
| 698 |
+
if(empty($addr[1])) {
|
| 699 |
+
$formatted = $this->SecureHeader($addr[0]);
|
| 700 |
+
} else {
|
| 701 |
+
$formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
|
| 702 |
+
}
|
| 703 |
+
|
| 704 |
+
return $formatted;
|
| 705 |
+
}
|
| 706 |
+
|
| 707 |
+
/**
|
| 708 |
+
* Wraps message for use with mailers that do not
|
| 709 |
+
* automatically perform wrapping and for quoted-printable.
|
| 710 |
+
* Original written by philippe.
|
| 711 |
+
* @access public
|
| 712 |
+
* @return string
|
| 713 |
+
*/
|
| 714 |
+
public function WrapText($message, $length, $qp_mode = false) {
|
| 715 |
+
$soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
|
| 716 |
+
// If utf-8 encoding is used, we will need to make sure we don't
|
| 717 |
+
// split multibyte characters when we wrap
|
| 718 |
+
$is_utf8 = (strtolower($this->CharSet) == "utf-8");
|
| 719 |
+
|
| 720 |
+
$message = $this->FixEOL($message);
|
| 721 |
+
if (substr($message, -1) == $this->LE) {
|
| 722 |
+
$message = substr($message, 0, -1);
|
| 723 |
+
}
|
| 724 |
+
|
| 725 |
+
$line = explode($this->LE, $message);
|
| 726 |
+
$message = '';
|
| 727 |
+
for ($i=0 ;$i < count($line); $i++) {
|
| 728 |
+
$line_part = explode(' ', $line[$i]);
|
| 729 |
+
$buf = '';
|
| 730 |
+
for ($e = 0; $e<count($line_part); $e++) {
|
| 731 |
+
$word = $line_part[$e];
|
| 732 |
+
if ($qp_mode and (strlen($word) > $length)) {
|
| 733 |
+
$space_left = $length - strlen($buf) - 1;
|
| 734 |
+
if ($e != 0) {
|
| 735 |
+
if ($space_left > 20) {
|
| 736 |
+
$len = $space_left;
|
| 737 |
+
if ($is_utf8) {
|
| 738 |
+
$len = $this->UTF8CharBoundary($word, $len);
|
| 739 |
+
} elseif (substr($word, $len - 1, 1) == "=") {
|
| 740 |
+
$len--;
|
| 741 |
+
} elseif (substr($word, $len - 2, 1) == "=") {
|
| 742 |
+
$len -= 2;
|
| 743 |
+
}
|
| 744 |
+
$part = substr($word, 0, $len);
|
| 745 |
+
$word = substr($word, $len);
|
| 746 |
+
$buf .= ' ' . $part;
|
| 747 |
+
$message .= $buf . sprintf("=%s", $this->LE);
|
| 748 |
+
} else {
|
| 749 |
+
$message .= $buf . $soft_break;
|
| 750 |
+
}
|
| 751 |
+
$buf = '';
|
| 752 |
+
}
|
| 753 |
+
while (strlen($word) > 0) {
|
| 754 |
+
$len = $length;
|
| 755 |
+
if ($is_utf8) {
|
| 756 |
+
$len = $this->UTF8CharBoundary($word, $len);
|
| 757 |
+
} elseif (substr($word, $len - 1, 1) == "=") {
|
| 758 |
+
$len--;
|
| 759 |
+
} elseif (substr($word, $len - 2, 1) == "=") {
|
| 760 |
+
$len -= 2;
|
| 761 |
+
}
|
| 762 |
+
$part = substr($word, 0, $len);
|
| 763 |
+
$word = substr($word, $len);
|
| 764 |
+
|
| 765 |
+
if (strlen($word) > 0) {
|
| 766 |
+
$message .= $part . sprintf("=%s", $this->LE);
|
| 767 |
+
} else {
|
| 768 |
+
$buf = $part;
|
| 769 |
+
}
|
| 770 |
+
}
|
| 771 |
+
} else {
|
| 772 |
+
$buf_o = $buf;
|
| 773 |
+
$buf .= ($e == 0) ? $word : (' ' . $word);
|
| 774 |
+
|
| 775 |
+
if (strlen($buf) > $length and $buf_o != '') {
|
| 776 |
+
$message .= $buf_o . $soft_break;
|
| 777 |
+
$buf = $word;
|
| 778 |
+
}
|
| 779 |
+
}
|
| 780 |
+
}
|
| 781 |
+
$message .= $buf . $this->LE;
|
| 782 |
+
}
|
| 783 |
+
|
| 784 |
+
return $message;
|
| 785 |
+
}
|
| 786 |
+
|
| 787 |
+
/**
|
| 788 |
+
* Finds last character boundary prior to maxLength in a utf-8
|
| 789 |
+
* quoted (printable) encoded string.
|
| 790 |
+
* Original written by Colin Brown.
|
| 791 |
+
* @access public
|
| 792 |
+
* @param string $encodedText utf-8 QP text
|
| 793 |
+
* @param int $maxLength find last character boundary prior to this length
|
| 794 |
+
* @return int
|
| 795 |
+
*/
|
| 796 |
+
public function UTF8CharBoundary($encodedText, $maxLength) {
|
| 797 |
+
$foundSplitPos = false;
|
| 798 |
+
$lookBack = 3;
|
| 799 |
+
while (!$foundSplitPos) {
|
| 800 |
+
$lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
|
| 801 |
+
$encodedCharPos = strpos($lastChunk, "=");
|
| 802 |
+
if ($encodedCharPos !== false) {
|
| 803 |
+
// Found start of encoded character byte within $lookBack block.
|
| 804 |
+
// Check the encoded byte value (the 2 chars after the '=')
|
| 805 |
+
$hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
|
| 806 |
+
$dec = hexdec($hex);
|
| 807 |
+
if ($dec < 128) { // Single byte character.
|
| 808 |
+
// If the encoded char was found at pos 0, it will fit
|
| 809 |
+
// otherwise reduce maxLength to start of the encoded char
|
| 810 |
+
$maxLength = ($encodedCharPos == 0) ? $maxLength :
|
| 811 |
+
$maxLength - ($lookBack - $encodedCharPos);
|
| 812 |
+
$foundSplitPos = true;
|
| 813 |
+
} elseif ($dec >= 192) { // First byte of a multi byte character
|
| 814 |
+
// Reduce maxLength to split at start of character
|
| 815 |
+
$maxLength = $maxLength - ($lookBack - $encodedCharPos);
|
| 816 |
+
$foundSplitPos = true;
|
| 817 |
+
} elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
|
| 818 |
+
$lookBack += 3;
|
| 819 |
+
}
|
| 820 |
+
} else {
|
| 821 |
+
// No encoded character found
|
| 822 |
+
$foundSplitPos = true;
|
| 823 |
+
}
|
| 824 |
+
}
|
| 825 |
+
return $maxLength;
|
| 826 |
+
}
|
| 827 |
+
|
| 828 |
+
|
| 829 |
+
/**
|
| 830 |
+
* Set the body wrapping.
|
| 831 |
+
* @access public
|
| 832 |
+
* @return void
|
| 833 |
+
*/
|
| 834 |
+
public function SetWordWrap() {
|
| 835 |
+
if($this->WordWrap < 1) {
|
| 836 |
+
return;
|
| 837 |
+
}
|
| 838 |
+
|
| 839 |
+
switch($this->message_type) {
|
| 840 |
+
case 'alt':
|
| 841 |
+
/* fall through */
|
| 842 |
+
case 'alt_attachments':
|
| 843 |
+
$this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
|
| 844 |
+
break;
|
| 845 |
+
default:
|
| 846 |
+
$this->Body = $this->WrapText($this->Body, $this->WordWrap);
|
| 847 |
+
break;
|
| 848 |
+
}
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
/**
|
| 852 |
+
* Assembles message header.
|
| 853 |
+
* @access public
|
| 854 |
+
* @return string
|
| 855 |
+
*/
|
| 856 |
+
public function CreateHeader() {
|
| 857 |
+
$result = '';
|
| 858 |
+
|
| 859 |
+
/* Set the boundaries */
|
| 860 |
+
$uniq_id = md5(uniqid(time()));
|
| 861 |
+
$this->boundary[1] = 'b1_' . $uniq_id;
|
| 862 |
+
$this->boundary[2] = 'b2_' . $uniq_id;
|
| 863 |
+
|
| 864 |
+
$result .= $this->HeaderLine('Date', $this->RFCDate());
|
| 865 |
+
if($this->Sender == '') {
|
| 866 |
+
$result .= $this->HeaderLine('Return-Path', trim($this->From));
|
| 867 |
+
} else {
|
| 868 |
+
$result .= $this->HeaderLine('Return-Path', trim($this->Sender));
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
+
/* To be created automatically by mail() */
|
| 872 |
+
if($this->Mailer != 'mail') {
|
| 873 |
+
if(count($this->to) > 0) {
|
| 874 |
+
$result .= $this->AddrAppend('To', $this->to);
|
| 875 |
+
} elseif (count($this->cc) == 0) {
|
| 876 |
+
$result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
|
| 877 |
+
}
|
| 878 |
+
if(count($this->cc) > 0) {
|
| 879 |
+
$result .= $this->AddrAppend('Cc', $this->cc);
|
| 880 |
+
}
|
| 881 |
+
}
|
| 882 |
+
|
| 883 |
+
$from = array();
|
| 884 |
+
$from[0][0] = trim($this->From);
|
| 885 |
+
$from[0][1] = $this->FromName;
|
| 886 |
+
$result .= $this->AddrAppend('From', $from);
|
| 887 |
+
|
| 888 |
+
/* sendmail and mail() extract Cc from the header before sending */
|
| 889 |
+
if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
|
| 890 |
+
$result .= $this->AddrAppend('Cc', $this->cc);
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
/* sendmail and mail() extract Bcc from the header before sending */
|
| 894 |
+
if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
|
| 895 |
+
$result .= $this->AddrAppend('Bcc', $this->bcc);
|
| 896 |
+
}
|
| 897 |
+
|
| 898 |
+
if(count($this->ReplyTo) > 0) {
|
| 899 |
+
$result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
/* mail() sets the subject itself */
|
| 903 |
+
if($this->Mailer != 'mail') {
|
| 904 |
+
$result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
|
| 905 |
+
}
|
| 906 |
+
|
| 907 |
+
if($this->MessageID != '') {
|
| 908 |
+
$result .= $this->HeaderLine('Message-ID',$this->MessageID);
|
| 909 |
+
} else {
|
| 910 |
+
$result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
|
| 911 |
+
}
|
| 912 |
+
$result .= $this->HeaderLine('X-Priority', $this->Priority);
|
| 913 |
+
$result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.codeworxtech.com) [version ' . $this->Version . ']');
|
| 914 |
+
|
| 915 |
+
if($this->ConfirmReadingTo != '') {
|
| 916 |
+
$result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
|
| 917 |
+
}
|
| 918 |
+
|
| 919 |
+
// Add custom headers
|
| 920 |
+
for($index = 0; $index < count($this->CustomHeader); $index++) {
|
| 921 |
+
$result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
|
| 922 |
+
}
|
| 923 |
+
if (!$this->sign_key_file) {
|
| 924 |
+
$result .= $this->HeaderLine('MIME-Version', '1.0');
|
| 925 |
+
$result .= $this->GetMailMIME();
|
| 926 |
+
}
|
| 927 |
+
|
| 928 |
+
return $result;
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
/**
|
| 932 |
+
* Returns the message MIME.
|
| 933 |
+
* @access public
|
| 934 |
+
* @return string
|
| 935 |
+
*/
|
| 936 |
+
public function GetMailMIME() {
|
| 937 |
+
$result = '';
|
| 938 |
+
switch($this->message_type) {
|
| 939 |
+
case 'plain':
|
| 940 |
+
$result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
|
| 941 |
+
$result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
|
| 942 |
+
break;
|
| 943 |
+
case 'attachments':
|
| 944 |
+
/* fall through */
|
| 945 |
+
case 'alt_attachments':
|
| 946 |
+
if($this->InlineImageExists()){
|
| 947 |
+
$result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
|
| 948 |
+
} else {
|
| 949 |
+
$result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
|
| 950 |
+
$result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
|
| 951 |
+
}
|
| 952 |
+
break;
|
| 953 |
+
case 'alt':
|
| 954 |
+
$result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
|
| 955 |
+
$result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
|
| 956 |
+
break;
|
| 957 |
+
}
|
| 958 |
+
|
| 959 |
+
if($this->Mailer != 'mail') {
|
| 960 |
+
$result .= $this->LE.$this->LE;
|
| 961 |
+
}
|
| 962 |
+
|
| 963 |
+
return $result;
|
| 964 |
+
}
|
| 965 |
+
|
| 966 |
+
/**
|
| 967 |
+
* Assembles the message body. Returns an empty string on failure.
|
| 968 |
+
* @access public
|
| 969 |
+
* @return string
|
| 970 |
+
*/
|
| 971 |
+
public function CreateBody() {
|
| 972 |
+
$result = '';
|
| 973 |
+
|
| 974 |
+
if ($this->sign_key_file) {
|
| 975 |
+
$result .= $this->GetMailMIME();
|
| 976 |
+
}
|
| 977 |
+
|
| 978 |
+
$this->SetWordWrap();
|
| 979 |
+
|
| 980 |
+
switch($this->message_type) {
|
| 981 |
+
case 'alt':
|
| 982 |
+
$result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
|
| 983 |
+
$result .= $this->EncodeString($this->AltBody, $this->Encoding);
|
| 984 |
+
$result .= $this->LE.$this->LE;
|
| 985 |
+
$result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
|
| 986 |
+
$result .= $this->EncodeString($this->Body, $this->Encoding);
|
| 987 |
+
$result .= $this->LE.$this->LE;
|
| 988 |
+
$result .= $this->EndBoundary($this->boundary[1]);
|
| 989 |
+
break;
|
| 990 |
+
case 'plain':
|
| 991 |
+
$result .= $this->EncodeString($this->Body, $this->Encoding);
|
| 992 |
+
break;
|
| 993 |
+
case 'attachments':
|
| 994 |
+
$result .= $this->GetBoundary($this->boundary[1], '', '', '');
|
| 995 |
+
$result .= $this->EncodeString($this->Body, $this->Encoding);
|
| 996 |
+
$result .= $this->LE;
|
| 997 |
+
$result .= $this->AttachAll();
|
| 998 |
+
break;
|
| 999 |
+
case 'alt_attachments':
|
| 1000 |
+
$result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
|
| 1001 |
+
$result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
|
| 1002 |
+
$result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
|
| 1003 |
+
$result .= $this->EncodeString($this->AltBody, $this->Encoding);
|
| 1004 |
+
$result .= $this->LE.$this->LE;
|
| 1005 |
+
$result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
|
| 1006 |
+
$result .= $this->EncodeString($this->Body, $this->Encoding);
|
| 1007 |
+
$result .= $this->LE.$this->LE;
|
| 1008 |
+
$result .= $this->EndBoundary($this->boundary[2]);
|
| 1009 |
+
$result .= $this->AttachAll();
|
| 1010 |
+
break;
|
| 1011 |
+
}
|
| 1012 |
+
|
| 1013 |
+
if($this->IsError()) {
|
| 1014 |
+
$result = '';
|
| 1015 |
+
} else if ($this->sign_key_file) {
|
| 1016 |
+
$file = tempnam("", "mail");
|
| 1017 |
+
$fp = fopen($file, "w");
|
| 1018 |
+
fwrite($fp, $result);
|
| 1019 |
+
fclose($fp);
|
| 1020 |
+
$signed = tempnam("", "signed");
|
| 1021 |
+
|
| 1022 |
+
if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
|
| 1023 |
+
$fp = fopen($signed, "r");
|
| 1024 |
+
$result = '';
|
| 1025 |
+
while(!feof($fp)){
|
| 1026 |
+
$result = $result . fread($fp, 1024);
|
| 1027 |
+
}
|
| 1028 |
+
fclose($fp);
|
| 1029 |
+
} else {
|
| 1030 |
+
$this->SetError($this->Lang("signing").openssl_error_string());
|
| 1031 |
+
$result = '';
|
| 1032 |
+
}
|
| 1033 |
+
|
| 1034 |
+
unlink($file);
|
| 1035 |
+
unlink($signed);
|
| 1036 |
+
}
|
| 1037 |
+
|
| 1038 |
+
return $result;
|
| 1039 |
+
}
|
| 1040 |
+
|
| 1041 |
+
/**
|
| 1042 |
+
* Returns the start of a message boundary.
|
| 1043 |
+
* @access public
|
| 1044 |
+
*/
|
| 1045 |
+
public function GetBoundary($boundary, $charSet, $contentType, $encoding) {
|
| 1046 |
+
$result = '';
|
| 1047 |
+
if($charSet == '') {
|
| 1048 |
+
$charSet = $this->CharSet;
|
| 1049 |
+
}
|
| 1050 |
+
if($contentType == '') {
|
| 1051 |
+
$contentType = $this->ContentType;
|
| 1052 |
+
}
|
| 1053 |
+
if($encoding == '') {
|
| 1054 |
+
$encoding = $this->Encoding;
|
| 1055 |
+
}
|
| 1056 |
+
$result .= $this->TextLine('--' . $boundary);
|
| 1057 |
+
$result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
|
| 1058 |
+
$result .= $this->LE;
|
| 1059 |
+
$result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
|
| 1060 |
+
$result .= $this->LE;
|
| 1061 |
+
|
| 1062 |
+
return $result;
|
| 1063 |
+
}
|
| 1064 |
+
|
| 1065 |
+
/**
|
| 1066 |
+
* Returns the end of a message boundary.
|
| 1067 |
+
* @access public
|
| 1068 |
+
*/
|
| 1069 |
+
public function EndBoundary($boundary) {
|
| 1070 |
+
return $this->LE . '--' . $boundary . '--' . $this->LE;
|
| 1071 |
+
}
|
| 1072 |
+
|
| 1073 |
+
/**
|
| 1074 |
+
* Sets the message type.
|
| 1075 |
+
* @access public
|
| 1076 |
+
* @return void
|
| 1077 |
+
*/
|
| 1078 |
+
public function SetMessageType() {
|
| 1079 |
+
if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
|
| 1080 |
+
$this->message_type = 'plain';
|
| 1081 |
+
} else {
|
| 1082 |
+
if(count($this->attachment) > 0) {
|
| 1083 |
+
$this->message_type = 'attachments';
|
| 1084 |
+
}
|
| 1085 |
+
if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
|
| 1086 |
+
$this->message_type = 'alt';
|
| 1087 |
+
}
|
| 1088 |
+
if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
|
| 1089 |
+
$this->message_type = 'alt_attachments';
|
| 1090 |
+
}
|
| 1091 |
+
}
|
| 1092 |
+
}
|
| 1093 |
+
|
| 1094 |
+
/* Returns a formatted header line.
|
| 1095 |
+
* @access public
|
| 1096 |
+
* @return string
|
| 1097 |
+
*/
|
| 1098 |
+
public function HeaderLine($name, $value) {
|
| 1099 |
+
return $name . ': ' . $value . $this->LE;
|
| 1100 |
+
}
|
| 1101 |
+
|
| 1102 |
+
/**
|
| 1103 |
+
* Returns a formatted mail line.
|
| 1104 |
+
* @access public
|
| 1105 |
+
* @return string
|
| 1106 |
+
*/
|
| 1107 |
+
public function TextLine($value) {
|
| 1108 |
+
return $value . $this->LE;
|
| 1109 |
+
}
|
| 1110 |
+
|
| 1111 |
+
/////////////////////////////////////////////////
|
| 1112 |
+
// CLASS METHODS, ATTACHMENTS
|
| 1113 |
+
/////////////////////////////////////////////////
|
| 1114 |
+
|
| 1115 |
+
/**
|
| 1116 |
+
* Adds an attachment from a path on the filesystem.
|
| 1117 |
+
* Returns false if the file could not be found
|
| 1118 |
+
* or accessed.
|
| 1119 |
+
* @param string $path Path to the attachment.
|
| 1120 |
+
* @param string $name Overrides the attachment name.
|
| 1121 |
+
* @param string $encoding File encoding (see $Encoding).
|
| 1122 |
+
* @param string $type File extension (MIME) type.
|
| 1123 |
+
* @return bool
|
| 1124 |
+
*/
|
| 1125 |
+
public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
|
| 1126 |
+
if(!@is_file($path)) {
|
| 1127 |
+
$this->SetError($this->Lang('file_access') . $path);
|
| 1128 |
+
return false;
|
| 1129 |
+
}
|
| 1130 |
+
|
| 1131 |
+
$filename = basename($path);
|
| 1132 |
+
if($name == '') {
|
| 1133 |
+
$name = $filename;
|
| 1134 |
+
}
|
| 1135 |
+
|
| 1136 |
+
$cur = count($this->attachment);
|
| 1137 |
+
$this->attachment[$cur][0] = $path;
|
| 1138 |
+
$this->attachment[$cur][1] = $filename;
|
| 1139 |
+
$this->attachment[$cur][2] = $name;
|
| 1140 |
+
$this->attachment[$cur][3] = $encoding;
|
| 1141 |
+
$this->attachment[$cur][4] = $type;
|
| 1142 |
+
$this->attachment[$cur][5] = false; // isStringAttachment
|
| 1143 |
+
$this->attachment[$cur][6] = 'attachment';
|
| 1144 |
+
$this->attachment[$cur][7] = 0;
|
| 1145 |
+
|
| 1146 |
+
return true;
|
| 1147 |
+
}
|
| 1148 |
+
|
| 1149 |
+
/**
|
| 1150 |
+
* Attaches all fs, string, and binary attachments to the message.
|
| 1151 |
+
* Returns an empty string on failure.
|
| 1152 |
+
* @access public
|
| 1153 |
+
* @return string
|
| 1154 |
+
*/
|
| 1155 |
+
public function AttachAll() {
|
| 1156 |
+
/* Return text of body */
|
| 1157 |
+
$mime = array();
|
| 1158 |
+
|
| 1159 |
+
/* Add all attachments */
|
| 1160 |
+
for($i = 0; $i < count($this->attachment); $i++) {
|
| 1161 |
+
/* Check for string attachment */
|
| 1162 |
+
$bString = $this->attachment[$i][5];
|
| 1163 |
+
if ($bString) {
|
| 1164 |
+
$string = $this->attachment[$i][0];
|
| 1165 |
+
} else {
|
| 1166 |
+
$path = $this->attachment[$i][0];
|
| 1167 |
+
}
|
| 1168 |
+
|
| 1169 |
+
$filename = $this->attachment[$i][1];
|
| 1170 |
+
$name = $this->attachment[$i][2];
|
| 1171 |
+
$encoding = $this->attachment[$i][3];
|
| 1172 |
+
$type = $this->attachment[$i][4];
|
| 1173 |
+
$disposition = $this->attachment[$i][6];
|
| 1174 |
+
$cid = $this->attachment[$i][7];
|
| 1175 |
+
|
| 1176 |
+
$mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
|
| 1177 |
+
//$mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
|
| 1178 |
+
$mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
|
| 1179 |
+
$mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
|
| 1180 |
+
|
| 1181 |
+
if($disposition == 'inline') {
|
| 1182 |
+
$mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
|
| 1183 |
+
}
|
| 1184 |
+
|
| 1185 |
+
//$mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
|
| 1186 |
+
$mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
|
| 1187 |
+
|
| 1188 |
+
/* Encode as string attachment */
|
| 1189 |
+
if($bString) {
|
| 1190 |
+
$mime[] = $this->EncodeString($string, $encoding);
|
| 1191 |
+
if($this->IsError()) {
|
| 1192 |
+
return '';
|
| 1193 |
+
}
|
| 1194 |
+
$mime[] = $this->LE.$this->LE;
|
| 1195 |
+
} else {
|
| 1196 |
+
$mime[] = $this->EncodeFile($path, $encoding);
|
| 1197 |
+
if($this->IsError()) {
|
| 1198 |
+
return '';
|
| 1199 |
+
}
|
| 1200 |
+
$mime[] = $this->LE.$this->LE;
|
| 1201 |
+
}
|
| 1202 |
+
}
|
| 1203 |
+
|
| 1204 |
+
$mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
|
| 1205 |
+
|
| 1206 |
+
return join('', $mime);
|
| 1207 |
+
}
|
| 1208 |
+
|
| 1209 |
+
/**
|
| 1210 |
+
* Encodes attachment in requested format. Returns an
|
| 1211 |
+
* empty string on failure.
|
| 1212 |
+
* @access public
|
| 1213 |
+
* @return string
|
| 1214 |
+
*/
|
| 1215 |
+
public function EncodeFile ($path, $encoding = 'base64') {
|
| 1216 |
+
if(!@$fd = fopen($path, 'rb')) {
|
| 1217 |
+
$this->SetError($this->Lang('file_open') . $path);
|
| 1218 |
+
return '';
|
| 1219 |
+
}
|
| 1220 |
+
if (function_exists('get_magic_quotes')) {
|
| 1221 |
+
function get_magic_quotes() {
|
| 1222 |
+
return false;
|
| 1223 |
+
}
|
| 1224 |
+
}
|
| 1225 |
+
if (PHP_VERSION < 6) {
|
| 1226 |
+
$magic_quotes = get_magic_quotes_runtime();
|
| 1227 |
+
set_magic_quotes_runtime(0);
|
| 1228 |
+
}
|
| 1229 |
+
$file_buffer = file_get_contents($path);
|
| 1230 |
+
$file_buffer = $this->EncodeString($file_buffer, $encoding);
|
| 1231 |
+
fclose($fd);
|
| 1232 |
+
if (PHP_VERSION < 6) { set_magic_quotes_runtime($magic_quotes); }
|
| 1233 |
+
return $file_buffer;
|
| 1234 |
+
}
|
| 1235 |
+
|
| 1236 |
+
/**
|
| 1237 |
+
* Encodes string to requested format. Returns an
|
| 1238 |
+
* empty string on failure.
|
| 1239 |
+
* @access public
|
| 1240 |
+
* @return string
|
| 1241 |
+
*/
|
| 1242 |
+
public function EncodeString ($str, $encoding = 'base64') {
|
| 1243 |
+
$encoded = '';
|
| 1244 |
+
switch(strtolower($encoding)) {
|
| 1245 |
+
case 'base64':
|
| 1246 |
+
$encoded = chunk_split(base64_encode($str), 76, $this->LE);
|
| 1247 |
+
break;
|
| 1248 |
+
case '7bit':
|
| 1249 |
+
case '8bit':
|
| 1250 |
+
$encoded = $this->FixEOL($str);
|
| 1251 |
+
if (substr($encoded, -(strlen($this->LE))) != $this->LE)
|
| 1252 |
+
$encoded .= $this->LE;
|
| 1253 |
+
break;
|
| 1254 |
+
case 'binary':
|
| 1255 |
+
$encoded = $str;
|
| 1256 |
+
break;
|
| 1257 |
+
case 'quoted-printable':
|
| 1258 |
+
$encoded = $this->EncodeQP($str);
|
| 1259 |
+
break;
|
| 1260 |
+
default:
|
| 1261 |
+
$this->SetError($this->Lang('encoding') . $encoding);
|
| 1262 |
+
break;
|
| 1263 |
+
}
|
| 1264 |
+
return $encoded;
|
| 1265 |
+
}
|
| 1266 |
+
|
| 1267 |
+
/**
|
| 1268 |
+
* Encode a header string to best of Q, B, quoted or none.
|
| 1269 |
+
* @access public
|
| 1270 |
+
* @return string
|
| 1271 |
+
*/
|
| 1272 |
+
public function EncodeHeader ($str, $position = 'text') {
|
| 1273 |
+
$x = 0;
|
| 1274 |
+
|
| 1275 |
+
switch (strtolower($position)) {
|
| 1276 |
+
case 'phrase':
|
| 1277 |
+
if (!preg_match('/[\200-\377]/', $str)) {
|
| 1278 |
+
/* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
|
| 1279 |
+
$encoded = addcslashes($str, "\0..\37\177\\\"");
|
| 1280 |
+
if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
|
| 1281 |
+
return ($encoded);
|
| 1282 |
+
} else {
|
| 1283 |
+
return ("\"$encoded\"");
|
| 1284 |
+
}
|
| 1285 |
+
}
|
| 1286 |
+
$x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
|
| 1287 |
+
break;
|
| 1288 |
+
case 'comment':
|
| 1289 |
+
$x = preg_match_all('/[()"]/', $str, $matches);
|
| 1290 |
+
/* Fall-through */
|
| 1291 |
+
case 'text':
|
| 1292 |
+
default:
|
| 1293 |
+
$x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
|
| 1294 |
+
break;
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
if ($x == 0) {
|
| 1298 |
+
return ($str);
|
| 1299 |
+
}
|
| 1300 |
+
|
| 1301 |
+
$maxlen = 75 - 7 - strlen($this->CharSet);
|
| 1302 |
+
/* Try to select the encoding which should produce the shortest output */
|
| 1303 |
+
if (strlen($str)/3 < $x) {
|
| 1304 |
+
$encoding = 'B';
|
| 1305 |
+
if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
|
| 1306 |
+
// Use a custom function which correctly encodes and wraps long
|
| 1307 |
+
// multibyte strings without breaking lines within a character
|
| 1308 |
+
$encoded = $this->Base64EncodeWrapMB($str);
|
| 1309 |
+
} else {
|
| 1310 |
+
$encoded = base64_encode($str);
|
| 1311 |
+
$maxlen -= $maxlen % 4;
|
| 1312 |
+
$encoded = trim(chunk_split($encoded, $maxlen, "\n"));
|
| 1313 |
+
}
|
| 1314 |
+
} else {
|
| 1315 |
+
$encoding = 'Q';
|
| 1316 |
+
$encoded = $this->EncodeQ($str, $position);
|
| 1317 |
+
$encoded = $this->WrapText($encoded, $maxlen, true);
|
| 1318 |
+
$encoded = str_replace('='.$this->LE, "\n", trim($encoded));
|
| 1319 |
+
}
|
| 1320 |
+
|
| 1321 |
+
$encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
|
| 1322 |
+
$encoded = trim(str_replace("\n", $this->LE, $encoded));
|
| 1323 |
+
|
| 1324 |
+
return $encoded;
|
| 1325 |
+
}
|
| 1326 |
+
|
| 1327 |
+
/**
|
| 1328 |
+
* Checks if a string contains multibyte characters.
|
| 1329 |
+
* @access public
|
| 1330 |
+
* @param string $str multi-byte text to wrap encode
|
| 1331 |
+
* @return bool
|
| 1332 |
+
*/
|
| 1333 |
+
public function HasMultiBytes($str) {
|
| 1334 |
+
if (function_exists('mb_strlen')) {
|
| 1335 |
+
return (strlen($str) > mb_strlen($str, $this->CharSet));
|
| 1336 |
+
} else { // Assume no multibytes (we can't handle without mbstring functions anyway)
|
| 1337 |
+
return False;
|
| 1338 |
+
}
|
| 1339 |
+
}
|
| 1340 |
+
|
| 1341 |
+
/**
|
| 1342 |
+
* Correctly encodes and wraps long multibyte strings for mail headers
|
| 1343 |
+
* without breaking lines within a character.
|
| 1344 |
+
* Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
|
| 1345 |
+
* @access public
|
| 1346 |
+
* @param string $str multi-byte text to wrap encode
|
| 1347 |
+
* @return string
|
| 1348 |
+
*/
|
| 1349 |
+
public function Base64EncodeWrapMB($str) {
|
| 1350 |
+
$start = "=?".$this->CharSet."?B?";
|
| 1351 |
+
$end = "?=";
|
| 1352 |
+
$encoded = "";
|
| 1353 |
+
|
| 1354 |
+
$mb_length = mb_strlen($str, $this->CharSet);
|
| 1355 |
+
// Each line must have length <= 75, including $start and $end
|
| 1356 |
+
$length = 75 - strlen($start) - strlen($end);
|
| 1357 |
+
// Average multi-byte ratio
|
| 1358 |
+
$ratio = $mb_length / strlen($str);
|
| 1359 |
+
// Base64 has a 4:3 ratio
|
| 1360 |
+
$offset = $avgLength = floor($length * $ratio * .75);
|
| 1361 |
+
|
| 1362 |
+
for ($i = 0; $i < $mb_length; $i += $offset) {
|
| 1363 |
+
$lookBack = 0;
|
| 1364 |
+
|
| 1365 |
+
do {
|
| 1366 |
+
$offset = $avgLength - $lookBack;
|
| 1367 |
+
$chunk = mb_substr($str, $i, $offset, $this->CharSet);
|
| 1368 |
+
$chunk = base64_encode($chunk);
|
| 1369 |
+
$lookBack++;
|
| 1370 |
+
}
|
| 1371 |
+
while (strlen($chunk) > $length);
|
| 1372 |
+
|
| 1373 |
+
$encoded .= $chunk . $this->LE;
|
| 1374 |
+
}
|
| 1375 |
+
|
| 1376 |
+
// Chomp the last linefeed
|
| 1377 |
+
$encoded = substr($encoded, 0, -strlen($this->LE));
|
| 1378 |
+
return $encoded;
|
| 1379 |
+
}
|
| 1380 |
+
|
| 1381 |
+
/**
|
| 1382 |
+
* Encode string to quoted-printable.
|
| 1383 |
+
* @access public
|
| 1384 |
+
* @param string $string the text to encode
|
| 1385 |
+
* @param integer $line_max Number of chars allowed on a line before wrapping
|
| 1386 |
+
* @return string
|
| 1387 |
+
*/
|
| 1388 |
+
public function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
|
| 1389 |
+
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
|
| 1390 |
+
$lines = preg_split('/(?:\r\n|\r|\n)/', $input);
|
| 1391 |
+
$eol = "\r\n";
|
| 1392 |
+
$escape = '=';
|
| 1393 |
+
$output = '';
|
| 1394 |
+
while( list(, $line) = each($lines) ) {
|
| 1395 |
+
$linlen = strlen($line);
|
| 1396 |
+
$newline = '';
|
| 1397 |
+
for($i = 0; $i < $linlen; $i++) {
|
| 1398 |
+
$c = substr( $line, $i, 1 );
|
| 1399 |
+
$dec = ord( $c );
|
| 1400 |
+
if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
|
| 1401 |
+
$c = '=2E';
|
| 1402 |
+
}
|
| 1403 |
+
if ( $dec == 32 ) {
|
| 1404 |
+
if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
|
| 1405 |
+
$c = '=20';
|
| 1406 |
+
} else if ( $space_conv ) {
|
| 1407 |
+
$c = '=20';
|
| 1408 |
+
}
|
| 1409 |
+
} elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
|
| 1410 |
+
$h2 = floor($dec/16);
|
| 1411 |
+
$h1 = floor($dec%16);
|
| 1412 |
+
$c = $escape.$hex[$h2].$hex[$h1];
|
| 1413 |
+
}
|
| 1414 |
+
if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
|
| 1415 |
+
$output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
|
| 1416 |
+
$newline = '';
|
| 1417 |
+
// check if newline first character will be point or not
|
| 1418 |
+
if ( $dec == 46 ) {
|
| 1419 |
+
$c = '=2E';
|
| 1420 |
+
}
|
| 1421 |
+
}
|
| 1422 |
+
$newline .= $c;
|
| 1423 |
+
} // end of for
|
| 1424 |
+
$output .= $newline.$eol;
|
| 1425 |
+
} // end of while
|
| 1426 |
+
return trim($output);
|
| 1427 |
+
}
|
| 1428 |
+
|
| 1429 |
+
/**
|
| 1430 |
+
* Encode string to q encoding.
|
| 1431 |
+
* @access public
|
| 1432 |
+
* @return string
|
| 1433 |
+
*/
|
| 1434 |
+
public function EncodeQ ($str, $position = 'text') {
|
| 1435 |
+
/* There should not be any EOL in the string */
|
| 1436 |
+
$encoded = preg_replace("[\r\n]", '', $str);
|
| 1437 |
+
|
| 1438 |
+
switch (strtolower($position)) {
|
| 1439 |
+
case 'phrase':
|
| 1440 |
+
$encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
| 1441 |
+
break;
|
| 1442 |
+
case 'comment':
|
| 1443 |
+
$encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
| 1444 |
+
case 'text':
|
| 1445 |
+
default:
|
| 1446 |
+
/* Replace every high ascii, control =, ? and _ characters */
|
| 1447 |
+
$encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
|
| 1448 |
+
"'='.sprintf('%02X', ord('\\1'))", $encoded);
|
| 1449 |
+
break;
|
| 1450 |
+
}
|
| 1451 |
+
|
| 1452 |
+
/* Replace every spaces to _ (more readable than =20) */
|
| 1453 |
+
$encoded = str_replace(' ', '_', $encoded);
|
| 1454 |
+
|
| 1455 |
+
return $encoded;
|
| 1456 |
+
}
|
| 1457 |
+
|
| 1458 |
+
/**
|
| 1459 |
+
* Adds a string or binary attachment (non-filesystem) to the list.
|
| 1460 |
+
* This method can be used to attach ascii or binary data,
|
| 1461 |
+
* such as a BLOB record from a database.
|
| 1462 |
+
* @param string $string String attachment data.
|
| 1463 |
+
* @param string $filename Name of the attachment.
|
| 1464 |
+
* @param string $encoding File encoding (see $Encoding).
|
| 1465 |
+
* @param string $type File extension (MIME) type.
|
| 1466 |
+
* @return void
|
| 1467 |
+
*/
|
| 1468 |
+
public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
|
| 1469 |
+
/* Append to $attachment array */
|
| 1470 |
+
$cur = count($this->attachment);
|
| 1471 |
+
$this->attachment[$cur][0] = $string;
|
| 1472 |
+
$this->attachment[$cur][1] = $filename;
|
| 1473 |
+
$this->attachment[$cur][2] = $filename;
|
| 1474 |
+
$this->attachment[$cur][3] = $encoding;
|
| 1475 |
+
$this->attachment[$cur][4] = $type;
|
| 1476 |
+
$this->attachment[$cur][5] = true; // isString
|
| 1477 |
+
$this->attachment[$cur][6] = 'attachment';
|
| 1478 |
+
$this->attachment[$cur][7] = 0;
|
| 1479 |
+
}
|
| 1480 |
+
|
| 1481 |
+
/**
|
| 1482 |
+
* Adds an embedded attachment. This can include images, sounds, and
|
| 1483 |
+
* just about any other document. Make sure to set the $type to an
|
| 1484 |
+
* image type. For JPEG images use "image/jpeg" and for GIF images
|
| 1485 |
+
* use "image/gif".
|
| 1486 |
+
* @param string $path Path to the attachment.
|
| 1487 |
+
* @param string $cid Content ID of the attachment. Use this to identify
|
| 1488 |
+
* the Id for accessing the image in an HTML form.
|
| 1489 |
+
* @param string $name Overrides the attachment name.
|
| 1490 |
+
* @param string $encoding File encoding (see $Encoding).
|
| 1491 |
+
* @param string $type File extension (MIME) type.
|
| 1492 |
+
* @return bool
|
| 1493 |
+
*/
|
| 1494 |
+
public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
|
| 1495 |
+
|
| 1496 |
+
if(!@is_file($path)) {
|
| 1497 |
+
$this->SetError($this->Lang('file_access') . $path);
|
| 1498 |
+
return false;
|
| 1499 |
+
}
|
| 1500 |
+
|
| 1501 |
+
$filename = basename($path);
|
| 1502 |
+
if($name == '') {
|
| 1503 |
+
$name = $filename;
|
| 1504 |
+
}
|
| 1505 |
+
|
| 1506 |
+
/* Append to $attachment array */
|
| 1507 |
+
$cur = count($this->attachment);
|
| 1508 |
+
$this->attachment[$cur][0] = $path;
|
| 1509 |
+
$this->attachment[$cur][1] = $filename;
|
| 1510 |
+
$this->attachment[$cur][2] = $name;
|
| 1511 |
+
$this->attachment[$cur][3] = $encoding;
|
| 1512 |
+
$this->attachment[$cur][4] = $type;
|
| 1513 |
+
$this->attachment[$cur][5] = false;
|
| 1514 |
+
$this->attachment[$cur][6] = 'inline';
|
| 1515 |
+
$this->attachment[$cur][7] = $cid;
|
| 1516 |
+
|
| 1517 |
+
return true;
|
| 1518 |
+
}
|
| 1519 |
+
|
| 1520 |
+
/**
|
| 1521 |
+
* Returns true if an inline attachment is present.
|
| 1522 |
+
* @access public
|
| 1523 |
+
* @return bool
|
| 1524 |
+
*/
|
| 1525 |
+
public function InlineImageExists() {
|
| 1526 |
+
$result = false;
|
| 1527 |
+
for($i = 0; $i < count($this->attachment); $i++) {
|
| 1528 |
+
if($this->attachment[$i][6] == 'inline') {
|
| 1529 |
+
$result = true;
|
| 1530 |
+
break;
|
| 1531 |
+
}
|
| 1532 |
+
}
|
| 1533 |
+
|
| 1534 |
+
return $result;
|
| 1535 |
+
}
|
| 1536 |
+
|
| 1537 |
+
/////////////////////////////////////////////////
|
| 1538 |
+
// CLASS METHODS, MESSAGE RESET
|
| 1539 |
+
/////////////////////////////////////////////////
|
| 1540 |
+
|
| 1541 |
+
/**
|
| 1542 |
+
* Clears all recipients assigned in the TO array. Returns void.
|
| 1543 |
+
* @return void
|
| 1544 |
+
*/
|
| 1545 |
+
public function ClearAddresses() {
|
| 1546 |
+
$this->to = array();
|
| 1547 |
+
}
|
| 1548 |
+
|
| 1549 |
+
/**
|
| 1550 |
+
* Clears all recipients assigned in the CC array. Returns void.
|
| 1551 |
+
* @return void
|
| 1552 |
+
*/
|
| 1553 |
+
public function ClearCCs() {
|
| 1554 |
+
$this->cc = array();
|
| 1555 |
+
}
|
| 1556 |
+
|
| 1557 |
+
/**
|
| 1558 |
+
* Clears all recipients assigned in the BCC array. Returns void.
|
| 1559 |
+
* @return void
|
| 1560 |
+
*/
|
| 1561 |
+
public function ClearBCCs() {
|
| 1562 |
+
$this->bcc = array();
|
| 1563 |
+
}
|
| 1564 |
+
|
| 1565 |
+
/**
|
| 1566 |
+
* Clears all recipients assigned in the ReplyTo array. Returns void.
|
| 1567 |
+
* @return void
|
| 1568 |
+
*/
|
| 1569 |
+
public function ClearReplyTos() {
|
| 1570 |
+
$this->ReplyTo = array();
|
| 1571 |
+
}
|
| 1572 |
+
|
| 1573 |
+
/**
|
| 1574 |
+
* Clears all recipients assigned in the TO, CC and BCC
|
| 1575 |
+
* array. Returns void.
|
| 1576 |
+
* @return void
|
| 1577 |
+
*/
|
| 1578 |
+
public function ClearAllRecipients() {
|
| 1579 |
+
$this->to = array();
|
| 1580 |
+
$this->cc = array();
|
| 1581 |
+
$this->bcc = array();
|
| 1582 |
+
}
|
| 1583 |
+
|
| 1584 |
+
/**
|
| 1585 |
+
* Clears all previously set filesystem, string, and binary
|
| 1586 |
+
* attachments. Returns void.
|
| 1587 |
+
* @return void
|
| 1588 |
+
*/
|
| 1589 |
+
public function ClearAttachments() {
|
| 1590 |
+
$this->attachment = array();
|
| 1591 |
+
}
|
| 1592 |
+
|
| 1593 |
+
/**
|
| 1594 |
+
* Clears all custom headers. Returns void.
|
| 1595 |
+
* @return void
|
| 1596 |
+
*/
|
| 1597 |
+
public function ClearCustomHeaders() {
|
| 1598 |
+
$this->CustomHeader = array();
|
| 1599 |
+
}
|
| 1600 |
+
|
| 1601 |
+
/////////////////////////////////////////////////
|
| 1602 |
+
// CLASS METHODS, MISCELLANEOUS
|
| 1603 |
+
/////////////////////////////////////////////////
|
| 1604 |
+
|
| 1605 |
+
/**
|
| 1606 |
+
* Adds the error message to the error container.
|
| 1607 |
+
* Returns void.
|
| 1608 |
+
* @access private
|
| 1609 |
+
* @return void
|
| 1610 |
+
*/
|
| 1611 |
+
private function SetError($msg) {
|
| 1612 |
+
$this->error_count++;
|
| 1613 |
+
$this->ErrorInfo = $msg;
|
| 1614 |
+
}
|
| 1615 |
+
|
| 1616 |
+
/**
|
| 1617 |
+
* Returns the proper RFC 822 formatted date.
|
| 1618 |
+
* @access private
|
| 1619 |
+
* @return string
|
| 1620 |
+
*/
|
| 1621 |
+
private static function RFCDate() {
|
| 1622 |
+
$tz = date('Z');
|
| 1623 |
+
$tzs = ($tz < 0) ? '-' : '+';
|
| 1624 |
+
$tz = abs($tz);
|
| 1625 |
+
$tz = (int)($tz/3600)*100 + ($tz%3600)/60;
|
| 1626 |
+
$result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
|
| 1627 |
+
|
| 1628 |
+
return $result;
|
| 1629 |
+
}
|
| 1630 |
+
|
| 1631 |
+
/**
|
| 1632 |
+
* Returns the server hostname or 'localhost.localdomain' if unknown.
|
| 1633 |
+
* @access private
|
| 1634 |
+
* @return string
|
| 1635 |
+
*/
|
| 1636 |
+
private function ServerHostname() {
|
| 1637 |
+
if (!empty($this->Hostname)) {
|
| 1638 |
+
$result = $this->Hostname;
|
| 1639 |
+
} elseif (isset($_SERVER['SERVER_NAME'])) {
|
| 1640 |
+
$result = $_SERVER['SERVER_NAME'];
|
| 1641 |
+
} else {
|
| 1642 |
+
$result = "localhost.localdomain";
|
| 1643 |
+
}
|
| 1644 |
+
|
| 1645 |
+
return $result;
|
| 1646 |
+
}
|
| 1647 |
+
|
| 1648 |
+
/**
|
| 1649 |
+
* Returns a message in the appropriate language.
|
| 1650 |
+
* @access private
|
| 1651 |
+
* @return string
|
| 1652 |
+
*/
|
| 1653 |
+
private function Lang($key) {
|
| 1654 |
+
if(count($this->language) < 1) {
|
| 1655 |
+
$this->SetLanguage('en'); // set the default language
|
| 1656 |
+
}
|
| 1657 |
+
|
| 1658 |
+
if(isset($this->language[$key])) {
|
| 1659 |
+
return $this->language[$key];
|
| 1660 |
+
} else {
|
| 1661 |
+
return 'Language string failed to load: ' . $key;
|
| 1662 |
+
}
|
| 1663 |
+
}
|
| 1664 |
+
|
| 1665 |
+
/**
|
| 1666 |
+
* Returns true if an error occurred.
|
| 1667 |
+
* @access public
|
| 1668 |
+
* @return bool
|
| 1669 |
+
*/
|
| 1670 |
+
public function IsError() {
|
| 1671 |
+
return ($this->error_count > 0);
|
| 1672 |
+
}
|
| 1673 |
+
|
| 1674 |
+
/**
|
| 1675 |
+
* Changes every end of line from CR or LF to CRLF.
|
| 1676 |
+
* @access private
|
| 1677 |
+
* @return string
|
| 1678 |
+
*/
|
| 1679 |
+
private function FixEOL($str) {
|
| 1680 |
+
$str = str_replace("\r\n", "\n", $str);
|
| 1681 |
+
$str = str_replace("\r", "\n", $str);
|
| 1682 |
+
$str = str_replace("\n", $this->LE, $str);
|
| 1683 |
+
return $str;
|
| 1684 |
+
}
|
| 1685 |
+
|
| 1686 |
+
/**
|
| 1687 |
+
* Adds a custom header.
|
| 1688 |
+
* @access public
|
| 1689 |
+
* @return void
|
| 1690 |
+
*/
|
| 1691 |
+
public function AddCustomHeader($custom_header) {
|
| 1692 |
+
$this->CustomHeader[] = explode(':', $custom_header, 2);
|
| 1693 |
+
}
|
| 1694 |
+
|
| 1695 |
+
/**
|
| 1696 |
+
* Evaluates the message and returns modifications for inline images and backgrounds
|
| 1697 |
+
* @access public
|
| 1698 |
+
* @return $message
|
| 1699 |
+
*/
|
| 1700 |
+
public function MsgHTML($message,$basedir='') {
|
| 1701 |
+
preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
|
| 1702 |
+
if(isset($images[2])) {
|
| 1703 |
+
foreach($images[2] as $i => $url) {
|
| 1704 |
+
// do not change urls for absolute images (thanks to corvuscorax)
|
| 1705 |
+
if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
|
| 1706 |
+
$filename = basename($url);
|
| 1707 |
+
$directory = dirname($url);
|
| 1708 |
+
($directory == '.')?$directory='':'';
|
| 1709 |
+
$cid = 'cid:' . md5($filename);
|
| 1710 |
+
$fileParts = split("\.", $filename);
|
| 1711 |
+
$ext = $fileParts[1];
|
| 1712 |
+
$mimeType = $this->_mime_types($ext);
|
| 1713 |
+
if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
|
| 1714 |
+
if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
|
| 1715 |
+
$this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
|
| 1716 |
+
if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
|
| 1717 |
+
$message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
|
| 1718 |
+
}
|
| 1719 |
+
}
|
| 1720 |
+
}
|
| 1721 |
+
}
|
| 1722 |
+
$this->IsHTML(true);
|
| 1723 |
+
$this->Body = $message;
|
| 1724 |
+
$textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
|
| 1725 |
+
if ( !empty($textMsg) && empty($this->AltBody) ) {
|
| 1726 |
+
$this->AltBody = $textMsg;
|
| 1727 |
+
}
|
| 1728 |
+
if ( empty($this->AltBody) ) {
|
| 1729 |
+
$this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
|
| 1730 |
+
}
|
| 1731 |
+
}
|
| 1732 |
+
|
| 1733 |
+
/**
|
| 1734 |
+
* Gets the mime type of the embedded or inline image
|
| 1735 |
+
* @access public
|
| 1736 |
+
* @return mime type of ext
|
| 1737 |
+
*/
|
| 1738 |
+
public function _mime_types($ext = '') {
|
| 1739 |
+
$mimes = array(
|
| 1740 |
+
'hqx' => 'application/mac-binhex40',
|
| 1741 |
+
'cpt' => 'application/mac-compactpro',
|
| 1742 |
+
'doc' => 'application/msword',
|
| 1743 |
+
'bin' => 'application/macbinary',
|
| 1744 |
+
'dms' => 'application/octet-stream',
|
| 1745 |
+
'lha' => 'application/octet-stream',
|
| 1746 |
+
'lzh' => 'application/octet-stream',
|
| 1747 |
+
'exe' => 'application/octet-stream',
|
| 1748 |
+
'class' => 'application/octet-stream',
|
| 1749 |
+
'psd' => 'application/octet-stream',
|
| 1750 |
+
'so' => 'application/octet-stream',
|
| 1751 |
+
'sea' => 'application/octet-stream',
|
| 1752 |
+
'dll' => 'application/octet-stream',
|
| 1753 |
+
'oda' => 'application/oda',
|
| 1754 |
+
'pdf' => 'application/pdf',
|
| 1755 |
+
'ai' => 'application/postscript',
|
| 1756 |
+
'eps' => 'application/postscript',
|
| 1757 |
+
'ps' => 'application/postscript',
|
| 1758 |
+
'smi' => 'application/smil',
|
| 1759 |
+
'smil' => 'application/smil',
|
| 1760 |
+
'mif' => 'application/vnd.mif',
|
| 1761 |
+
'xls' => 'application/vnd.ms-excel',
|
| 1762 |
+
'ppt' => 'application/vnd.ms-powerpoint',
|
| 1763 |
+
'wbxml' => 'application/vnd.wap.wbxml',
|
| 1764 |
+
'wmlc' => 'application/vnd.wap.wmlc',
|
| 1765 |
+
'dcr' => 'application/x-director',
|
| 1766 |
+
'dir' => 'application/x-director',
|
| 1767 |
+
'dxr' => 'application/x-director',
|
| 1768 |
+
'dvi' => 'application/x-dvi',
|
| 1769 |
+
'gtar' => 'application/x-gtar',
|
| 1770 |
+
'php' => 'application/x-httpd-php',
|
| 1771 |
+
'php4' => 'application/x-httpd-php',
|
| 1772 |
+
'php3' => 'application/x-httpd-php',
|
| 1773 |
+
'phtml' => 'application/x-httpd-php',
|
| 1774 |
+
'phps' => 'application/x-httpd-php-source',
|
| 1775 |
+
'js' => 'application/x-javascript',
|
| 1776 |
+
'swf' => 'application/x-shockwave-flash',
|
| 1777 |
+
'sit' => 'application/x-stuffit',
|
| 1778 |
+
'tar' => 'application/x-tar',
|
| 1779 |
+
'tgz' => 'application/x-tar',
|
| 1780 |
+
'xhtml' => 'application/xhtml+xml',
|
| 1781 |
+
'xht' => 'application/xhtml+xml',
|
| 1782 |
+
'zip' => 'application/zip',
|
| 1783 |
+
'mid' => 'audio/midi',
|
| 1784 |
+
'midi' => 'audio/midi',
|
| 1785 |
+
'mpga' => 'audio/mpeg',
|
| 1786 |
+
'mp2' => 'audio/mpeg',
|
| 1787 |
+
'mp3' => 'audio/mpeg',
|
| 1788 |
+
'aif' => 'audio/x-aiff',
|
| 1789 |
+
'aiff' => 'audio/x-aiff',
|
| 1790 |
+
'aifc' => 'audio/x-aiff',
|
| 1791 |
+
'ram' => 'audio/x-pn-realaudio',
|
| 1792 |
+
'rm' => 'audio/x-pn-realaudio',
|
| 1793 |
+
'rpm' => 'audio/x-pn-realaudio-plugin',
|
| 1794 |
+
'ra' => 'audio/x-realaudio',
|
| 1795 |
+
'rv' => 'video/vnd.rn-realvideo',
|
| 1796 |
+
'wav' => 'audio/x-wav',
|
| 1797 |
+
'bmp' => 'image/bmp',
|
| 1798 |
+
'gif' => 'image/gif',
|
| 1799 |
+
'jpeg' => 'image/jpeg',
|
| 1800 |
+
'jpg' => 'image/jpeg',
|
| 1801 |
+
'jpe' => 'image/jpeg',
|
| 1802 |
+
'png' => 'image/png',
|
| 1803 |
+
'tiff' => 'image/tiff',
|
| 1804 |
+
'tif' => 'image/tiff',
|
| 1805 |
+
'css' => 'text/css',
|
| 1806 |
+
'html' => 'text/html',
|
| 1807 |
+
'htm' => 'text/html',
|
| 1808 |
+
'shtml' => 'text/html',
|
| 1809 |
+
'txt' => 'text/plain',
|
| 1810 |
+
'text' => 'text/plain',
|
| 1811 |
+
'log' => 'text/plain',
|
| 1812 |
+
'rtx' => 'text/richtext',
|
| 1813 |
+
'rtf' => 'text/rtf',
|
| 1814 |
+
'xml' => 'text/xml',
|
| 1815 |
+
'xsl' => 'text/xml',
|
| 1816 |
+
'mpeg' => 'video/mpeg',
|
| 1817 |
+
'mpg' => 'video/mpeg',
|
| 1818 |
+
'mpe' => 'video/mpeg',
|
| 1819 |
+
'qt' => 'video/quicktime',
|
| 1820 |
+
'mov' => 'video/quicktime',
|
| 1821 |
+
'avi' => 'video/x-msvideo',
|
| 1822 |
+
'movie' => 'video/x-sgi-movie',
|
| 1823 |
+
'doc' => 'application/msword',
|
| 1824 |
+
'word' => 'application/msword',
|
| 1825 |
+
'xl' => 'application/excel',
|
| 1826 |
+
'eml' => 'message/rfc822'
|
| 1827 |
+
);
|
| 1828 |
+
return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
|
| 1829 |
+
}
|
| 1830 |
+
|
| 1831 |
+
/**
|
| 1832 |
+
* Set (or reset) Class Objects (variables)
|
| 1833 |
+
*
|
| 1834 |
+
* Usage Example:
|
| 1835 |
+
* $page->set('X-Priority', '3');
|
| 1836 |
+
*
|
| 1837 |
+
* @access public
|
| 1838 |
+
* @param string $name Parameter Name
|
| 1839 |
+
* @param mixed $value Parameter Value
|
| 1840 |
+
* NOTE: will not work with arrays, there are no arrays to set/reset
|
| 1841 |
+
*/
|
| 1842 |
+
public function set ( $name, $value = '' ) {
|
| 1843 |
+
if ( isset($this->$name) ) {
|
| 1844 |
+
$this->$name = $value;
|
| 1845 |
+
} else {
|
| 1846 |
+
$this->SetError('Cannot set or reset variable ' . $name);
|
| 1847 |
+
return false;
|
| 1848 |
+
}
|
| 1849 |
+
}
|
| 1850 |
+
|
| 1851 |
+
/**
|
| 1852 |
+
* Read a file from a supplied filename and return it.
|
| 1853 |
+
*
|
| 1854 |
+
* @access public
|
| 1855 |
+
* @param string $filename Parameter File Name
|
| 1856 |
+
*/
|
| 1857 |
+
public function getFile($filename) {
|
| 1858 |
+
$return = '';
|
| 1859 |
+
if ($fp = fopen($filename, 'rb')) {
|
| 1860 |
+
while (!feof($fp)) {
|
| 1861 |
+
$return .= fread($fp, 1024);
|
| 1862 |
+
}
|
| 1863 |
+
fclose($fp);
|
| 1864 |
+
return $return;
|
| 1865 |
+
} else {
|
| 1866 |
+
return false;
|
| 1867 |
+
}
|
| 1868 |
+
}
|
| 1869 |
+
|
| 1870 |
+
/**
|
| 1871 |
+
* Strips newlines to prevent header injection.
|
| 1872 |
+
* @access public
|
| 1873 |
+
* @param string $str String
|
| 1874 |
+
* @return string
|
| 1875 |
+
*/
|
| 1876 |
+
public function SecureHeader($str) {
|
| 1877 |
+
$str = trim($str);
|
| 1878 |
+
$str = str_replace("\r", "", $str);
|
| 1879 |
+
$str = str_replace("\n", "", $str);
|
| 1880 |
+
return $str;
|
| 1881 |
+
}
|
| 1882 |
+
|
| 1883 |
+
/**
|
| 1884 |
+
* Set the private key file and password to sign the message.
|
| 1885 |
+
*
|
| 1886 |
+
* @access public
|
| 1887 |
+
* @param string $key_filename Parameter File Name
|
| 1888 |
+
* @param string $key_pass Password for private key
|
| 1889 |
+
*/
|
| 1890 |
+
public function Sign($cert_filename, $key_filename, $key_pass) {
|
| 1891 |
+
$this->sign_cert_file = $cert_filename;
|
| 1892 |
+
$this->sign_key_file = $key_filename;
|
| 1893 |
+
$this->sign_key_pass = $key_pass;
|
| 1894 |
+
}
|
| 1895 |
+
}
|
| 1896 |
+
|
| 1897 |
+
?>
|
app/code/community/MageTracking/TicketSystem/Helper/Smtp.php
ADDED
|
@@ -0,0 +1,1113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
| 6 |
+
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
|
| 7 |
+
| Info: http://phpmailer.sourceforge.net |
|
| 8 |
+
| Support: http://sourceforge.net/projects/phpmailer/ |
|
| 9 |
+
| ------------------------------------------------------------------------- |
|
| 10 |
+
| Author: Andy Prevost (project admininistrator) |
|
| 11 |
+
| Author: Brent R. Matzelle (original founder) |
|
| 12 |
+
| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
|
| 13 |
+
| Copyright (c) 2001-2003, Brent R. Matzelle |
|
| 14 |
+
| ------------------------------------------------------------------------- |
|
| 15 |
+
| License: Distributed under the Lesser General Public License (LGPL) |
|
| 16 |
+
| http://www.gnu.org/copyleft/lesser.html |
|
| 17 |
+
| This program is distributed in the hope that it will be useful - WITHOUT |
|
| 18 |
+
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
| 19 |
+
| FITNESS FOR A PARTICULAR PURPOSE. |
|
| 20 |
+
| ------------------------------------------------------------------------- |
|
| 21 |
+
| We offer a number of paid services (www.codeworxtech.com): |
|
| 22 |
+
| - Web Hosting on highly optimized fast and secure servers |
|
| 23 |
+
| - Technology Consulting |
|
| 24 |
+
| - Oursourcing (highly qualified programmers and graphic designers) |
|
| 25 |
+
'---------------------------------------------------------------------------'
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
|
| 29 |
+
* commands except TURN which will always return a not implemented
|
| 30 |
+
* error. SMTP also provides some utility methods for sending mail
|
| 31 |
+
* to an SMTP server.
|
| 32 |
+
* @package PHPMailer
|
| 33 |
+
* @author Chris Ryan
|
| 34 |
+
*/
|
| 35 |
+
echo "stop4";die();
|
| 36 |
+
class SMTP {
|
| 37 |
+
/**
|
| 38 |
+
* SMTP server port
|
| 39 |
+
* @var int
|
| 40 |
+
*/
|
| 41 |
+
public $SMTP_PORT = 25;
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* SMTP reply line ending
|
| 45 |
+
* @var string
|
| 46 |
+
*/
|
| 47 |
+
public $CRLF = "\r\n";
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Sets whether debugging is turned on
|
| 51 |
+
* @var bool
|
| 52 |
+
*/
|
| 53 |
+
public $do_debug; // the level of debug to perform
|
| 54 |
+
|
| 55 |
+
/**
|
| 56 |
+
* Sets VERP use on/off (default is off)
|
| 57 |
+
* @var bool
|
| 58 |
+
*/
|
| 59 |
+
public $do_verp = false;
|
| 60 |
+
|
| 61 |
+
/**#@+
|
| 62 |
+
* @access private
|
| 63 |
+
*/
|
| 64 |
+
private $smtp_conn; // the socket to the server
|
| 65 |
+
private $error; // error if any on the last call
|
| 66 |
+
private $helo_rply; // the reply the server sent to us for HELO
|
| 67 |
+
/**#@-*/
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Initialize the class so that the data is in a known state.
|
| 71 |
+
* @access public
|
| 72 |
+
* @return void
|
| 73 |
+
*/
|
| 74 |
+
public function __construct() {
|
| 75 |
+
$this->smtp_conn = 0;
|
| 76 |
+
$this->error = null;
|
| 77 |
+
$this->helo_rply = null;
|
| 78 |
+
|
| 79 |
+
$this->do_debug = 0;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/*************************************************************
|
| 83 |
+
* CONNECTION FUNCTIONS *
|
| 84 |
+
***********************************************************/
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Connect to the server specified on the port specified.
|
| 88 |
+
* If the port is not specified use the default SMTP_PORT.
|
| 89 |
+
* If tval is specified then a connection will try and be
|
| 90 |
+
* established with the server for that number of seconds.
|
| 91 |
+
* If tval is not specified the default is 30 seconds to
|
| 92 |
+
* try on the connection.
|
| 93 |
+
*
|
| 94 |
+
* SMTP CODE SUCCESS: 220
|
| 95 |
+
* SMTP CODE FAILURE: 421
|
| 96 |
+
* @access public
|
| 97 |
+
* @return bool
|
| 98 |
+
*/
|
| 99 |
+
public function Connect($host,$port=0,$tval=30) {
|
| 100 |
+
/* set the error val to null so there is no confusion */
|
| 101 |
+
$this->error = null;
|
| 102 |
+
|
| 103 |
+
/* make sure we are __not__ connected */
|
| 104 |
+
if($this->connected()) {
|
| 105 |
+
/* ok we are connected! what should we do?
|
| 106 |
+
* for now we will just give an error saying we
|
| 107 |
+
* are already connected
|
| 108 |
+
*/
|
| 109 |
+
$this->error = array("error" => "Already connected to a server");
|
| 110 |
+
return false;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
if(empty($port)) {
|
| 114 |
+
$port = $this->SMTP_PORT;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/* connect to the smtp server */
|
| 118 |
+
$this->smtp_conn = fsockopen($host, // the host of the server
|
| 119 |
+
$port, // the port to use
|
| 120 |
+
$errno, // error number if any
|
| 121 |
+
$errstr, // error message if any
|
| 122 |
+
$tval); // give up after ? secs
|
| 123 |
+
/* verify we connected properly */
|
| 124 |
+
if(empty($this->smtp_conn)) {
|
| 125 |
+
$this->error = array("error" => "Failed to connect to server",
|
| 126 |
+
"errno" => $errno,
|
| 127 |
+
"errstr" => $errstr);
|
| 128 |
+
if($this->do_debug >= 1) {
|
| 129 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 130 |
+
": $errstr ($errno)" . $this->CRLF;
|
| 131 |
+
}
|
| 132 |
+
return false;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/* sometimes the SMTP server takes a little longer to respond
|
| 136 |
+
* so we will give it a longer timeout for the first read
|
| 137 |
+
* - Windows still does not have support for this timeout function
|
| 138 |
+
*/
|
| 139 |
+
if(substr(PHP_OS, 0, 3) != "WIN")
|
| 140 |
+
socket_set_timeout($this->smtp_conn, $tval, 0);
|
| 141 |
+
|
| 142 |
+
/* get any announcement stuff */
|
| 143 |
+
$announce = $this->get_lines();
|
| 144 |
+
|
| 145 |
+
/* set the timeout of any socket functions at 1/10 of a second */
|
| 146 |
+
//if(function_exists("socket_set_timeout"))
|
| 147 |
+
// socket_set_timeout($this->smtp_conn, 0, 100000);
|
| 148 |
+
|
| 149 |
+
if($this->do_debug >= 2) {
|
| 150 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
return true;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
/**
|
| 157 |
+
* Initiate a TSL communication with the server.
|
| 158 |
+
*
|
| 159 |
+
* SMTP CODE 220 Ready to start TLS
|
| 160 |
+
* SMTP CODE 501 Syntax error (no parameters allowed)
|
| 161 |
+
* SMTP CODE 454 TLS not available due to temporary reason
|
| 162 |
+
* @access public
|
| 163 |
+
* @return bool success
|
| 164 |
+
*/
|
| 165 |
+
public function StartTLS() {
|
| 166 |
+
$this->error = null; # to avoid confusion
|
| 167 |
+
|
| 168 |
+
if(!$this->connected()) {
|
| 169 |
+
$this->error = array("error" => "Called StartTLS() without being connected");
|
| 170 |
+
return false;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
fputs($this->smtp_conn,"STARTTLS" . $extra . $this->CRLF);
|
| 174 |
+
|
| 175 |
+
$rply = $this->get_lines();
|
| 176 |
+
$code = substr($rply,0,3);
|
| 177 |
+
|
| 178 |
+
if($this->do_debug >= 2) {
|
| 179 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
if($code != 220) {
|
| 183 |
+
$this->error =
|
| 184 |
+
array("error" => "STARTTLS not accepted from server",
|
| 185 |
+
"smtp_code" => $code,
|
| 186 |
+
"smtp_msg" => substr($rply,4));
|
| 187 |
+
if($this->do_debug >= 1) {
|
| 188 |
+
echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
|
| 189 |
+
}
|
| 190 |
+
return false;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
//Begin encrypted connection
|
| 194 |
+
if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
|
| 195 |
+
return false;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
return true;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
/**
|
| 202 |
+
* Performs SMTP authentication. Must be run after running the
|
| 203 |
+
* Hello() method. Returns true if successfully authenticated.
|
| 204 |
+
* @access public
|
| 205 |
+
* @return bool
|
| 206 |
+
*/
|
| 207 |
+
public function Authenticate($username, $password) {
|
| 208 |
+
// Start authentication
|
| 209 |
+
fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
|
| 210 |
+
|
| 211 |
+
$rply = $this->get_lines();
|
| 212 |
+
$code = substr($rply,0,3);
|
| 213 |
+
|
| 214 |
+
if($code != 334) {
|
| 215 |
+
$this->error =
|
| 216 |
+
array("error" => "AUTH not accepted from server",
|
| 217 |
+
"smtp_code" => $code,
|
| 218 |
+
"smtp_msg" => substr($rply,4));
|
| 219 |
+
if($this->do_debug >= 1) {
|
| 220 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 221 |
+
": " . $rply . $this->CRLF;
|
| 222 |
+
}
|
| 223 |
+
return false;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
// Send encoded username
|
| 227 |
+
fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
|
| 228 |
+
|
| 229 |
+
$rply = $this->get_lines();
|
| 230 |
+
$code = substr($rply,0,3);
|
| 231 |
+
|
| 232 |
+
if($code != 334) {
|
| 233 |
+
$this->error =
|
| 234 |
+
array("error" => "Username not accepted from server",
|
| 235 |
+
"smtp_code" => $code,
|
| 236 |
+
"smtp_msg" => substr($rply,4));
|
| 237 |
+
if($this->do_debug >= 1) {
|
| 238 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 239 |
+
": " . $rply . $this->CRLF;
|
| 240 |
+
}
|
| 241 |
+
return false;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
// Send encoded password
|
| 245 |
+
fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
|
| 246 |
+
|
| 247 |
+
$rply = $this->get_lines();
|
| 248 |
+
$code = substr($rply,0,3);
|
| 249 |
+
|
| 250 |
+
if($code != 235) {
|
| 251 |
+
$this->error =
|
| 252 |
+
array("error" => "Password not accepted from server",
|
| 253 |
+
"smtp_code" => $code,
|
| 254 |
+
"smtp_msg" => substr($rply,4));
|
| 255 |
+
if($this->do_debug >= 1) {
|
| 256 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 257 |
+
": " . $rply . $this->CRLF;
|
| 258 |
+
}
|
| 259 |
+
return false;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
return true;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* Returns true if connected to a server otherwise false
|
| 267 |
+
* @access public
|
| 268 |
+
* @return bool
|
| 269 |
+
*/
|
| 270 |
+
public function Connected() {
|
| 271 |
+
if(!empty($this->smtp_conn)) {
|
| 272 |
+
$sock_status = socket_get_status($this->smtp_conn);
|
| 273 |
+
if($sock_status["eof"]) {
|
| 274 |
+
// hmm this is an odd situation... the socket is
|
| 275 |
+
// valid but we are not connected anymore
|
| 276 |
+
if($this->do_debug >= 1) {
|
| 277 |
+
echo "SMTP -> NOTICE:" . $this->CRLF .
|
| 278 |
+
"EOF caught while checking if connected";
|
| 279 |
+
}
|
| 280 |
+
$this->Close();
|
| 281 |
+
return false;
|
| 282 |
+
}
|
| 283 |
+
return true; // everything looks good
|
| 284 |
+
}
|
| 285 |
+
return false;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
/**
|
| 289 |
+
* Closes the socket and cleans up the state of the class.
|
| 290 |
+
* It is not considered good to use this function without
|
| 291 |
+
* first trying to use QUIT.
|
| 292 |
+
* @access public
|
| 293 |
+
* @return void
|
| 294 |
+
*/
|
| 295 |
+
public function Close() {
|
| 296 |
+
$this->error = null; // so there is no confusion
|
| 297 |
+
$this->helo_rply = null;
|
| 298 |
+
if(!empty($this->smtp_conn)) {
|
| 299 |
+
// close the connection and cleanup
|
| 300 |
+
fclose($this->smtp_conn);
|
| 301 |
+
$this->smtp_conn = 0;
|
| 302 |
+
}
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
/***************************************************************
|
| 306 |
+
* SMTP COMMANDS *
|
| 307 |
+
*************************************************************/
|
| 308 |
+
|
| 309 |
+
/**
|
| 310 |
+
* Issues a data command and sends the msg_data to the server
|
| 311 |
+
* finializing the mail transaction. $msg_data is the message
|
| 312 |
+
* that is to be send with the headers. Each header needs to be
|
| 313 |
+
* on a single line followed by a <CRLF> with the message headers
|
| 314 |
+
* and the message body being seperated by and additional <CRLF>.
|
| 315 |
+
*
|
| 316 |
+
* Implements rfc 821: DATA <CRLF>
|
| 317 |
+
*
|
| 318 |
+
* SMTP CODE INTERMEDIATE: 354
|
| 319 |
+
* [data]
|
| 320 |
+
* <CRLF>.<CRLF>
|
| 321 |
+
* SMTP CODE SUCCESS: 250
|
| 322 |
+
* SMTP CODE FAILURE: 552,554,451,452
|
| 323 |
+
* SMTP CODE FAILURE: 451,554
|
| 324 |
+
* SMTP CODE ERROR : 500,501,503,421
|
| 325 |
+
* @access public
|
| 326 |
+
* @return bool
|
| 327 |
+
*/
|
| 328 |
+
public function Data($msg_data) {
|
| 329 |
+
$this->error = null; // so no confusion is caused
|
| 330 |
+
|
| 331 |
+
if(!$this->connected()) {
|
| 332 |
+
$this->error = array(
|
| 333 |
+
"error" => "Called Data() without being connected");
|
| 334 |
+
return false;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
fputs($this->smtp_conn,"DATA" . $this->CRLF);
|
| 338 |
+
|
| 339 |
+
$rply = $this->get_lines();
|
| 340 |
+
$code = substr($rply,0,3);
|
| 341 |
+
|
| 342 |
+
if($this->do_debug >= 2) {
|
| 343 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
if($code != 354) {
|
| 347 |
+
$this->error =
|
| 348 |
+
array("error" => "DATA command not accepted from server",
|
| 349 |
+
"smtp_code" => $code,
|
| 350 |
+
"smtp_msg" => substr($rply,4));
|
| 351 |
+
if($this->do_debug >= 1) {
|
| 352 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 353 |
+
": " . $rply . $this->CRLF;
|
| 354 |
+
}
|
| 355 |
+
return false;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
/* the server is ready to accept data!
|
| 359 |
+
* according to rfc 821 we should not send more than 1000
|
| 360 |
+
* including the CRLF
|
| 361 |
+
* characters on a single line so we will break the data up
|
| 362 |
+
* into lines by \r and/or \n then if needed we will break
|
| 363 |
+
* each of those into smaller lines to fit within the limit.
|
| 364 |
+
* in addition we will be looking for lines that start with
|
| 365 |
+
* a period '.' and append and additional period '.' to that
|
| 366 |
+
* line. NOTE: this does not count towards are limit.
|
| 367 |
+
*/
|
| 368 |
+
|
| 369 |
+
// normalize the line breaks so we know the explode works
|
| 370 |
+
$msg_data = str_replace("\r\n","\n",$msg_data);
|
| 371 |
+
$msg_data = str_replace("\r","\n",$msg_data);
|
| 372 |
+
$lines = explode("\n",$msg_data);
|
| 373 |
+
|
| 374 |
+
/* we need to find a good way to determine is headers are
|
| 375 |
+
* in the msg_data or if it is a straight msg body
|
| 376 |
+
* currently I am assuming rfc 822 definitions of msg headers
|
| 377 |
+
* and if the first field of the first line (':' sperated)
|
| 378 |
+
* does not contain a space then it _should_ be a header
|
| 379 |
+
* and we can process all lines before a blank "" line as
|
| 380 |
+
* headers.
|
| 381 |
+
*/
|
| 382 |
+
$field = substr($lines[0],0,strpos($lines[0],":"));
|
| 383 |
+
$in_headers = false;
|
| 384 |
+
if(!empty($field) && !strstr($field," ")) {
|
| 385 |
+
$in_headers = true;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
$max_line_length = 998; // used below; set here for ease in change
|
| 389 |
+
|
| 390 |
+
while(list(,$line) = @each($lines)) {
|
| 391 |
+
$lines_out = null;
|
| 392 |
+
if($line == "" && $in_headers) {
|
| 393 |
+
$in_headers = false;
|
| 394 |
+
}
|
| 395 |
+
// ok we need to break this line up into several smaller lines
|
| 396 |
+
while(strlen($line) > $max_line_length) {
|
| 397 |
+
$pos = strrpos(substr($line,0,$max_line_length)," ");
|
| 398 |
+
|
| 399 |
+
// Patch to fix DOS attack
|
| 400 |
+
if(!$pos) {
|
| 401 |
+
$pos = $max_line_length - 1;
|
| 402 |
+
$lines_out[] = substr($line,0,$pos);
|
| 403 |
+
$line = substr($line,$pos);
|
| 404 |
+
} else {
|
| 405 |
+
$lines_out[] = substr($line,0,$pos);
|
| 406 |
+
$line = substr($line,$pos + 1);
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
/* if we are processing headers we need to
|
| 410 |
+
* add a LWSP-char to the front of the new line
|
| 411 |
+
* rfc 822 on long msg headers
|
| 412 |
+
*/
|
| 413 |
+
if($in_headers) {
|
| 414 |
+
$line = "\t" . $line;
|
| 415 |
+
}
|
| 416 |
+
}
|
| 417 |
+
$lines_out[] = $line;
|
| 418 |
+
|
| 419 |
+
// now send the lines to the server
|
| 420 |
+
while(list(,$line_out) = @each($lines_out)) {
|
| 421 |
+
if(strlen($line_out) > 0)
|
| 422 |
+
{
|
| 423 |
+
if(substr($line_out, 0, 1) == ".") {
|
| 424 |
+
$line_out = "." . $line_out;
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
fputs($this->smtp_conn,$line_out . $this->CRLF);
|
| 428 |
+
}
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
// ok all the message data has been sent so lets get this
|
| 432 |
+
// over with aleady
|
| 433 |
+
fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
|
| 434 |
+
|
| 435 |
+
$rply = $this->get_lines();
|
| 436 |
+
$code = substr($rply,0,3);
|
| 437 |
+
|
| 438 |
+
if($this->do_debug >= 2) {
|
| 439 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
if($code != 250) {
|
| 443 |
+
$this->error =
|
| 444 |
+
array("error" => "DATA not accepted from server",
|
| 445 |
+
"smtp_code" => $code,
|
| 446 |
+
"smtp_msg" => substr($rply,4));
|
| 447 |
+
if($this->do_debug >= 1) {
|
| 448 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 449 |
+
": " . $rply . $this->CRLF;
|
| 450 |
+
}
|
| 451 |
+
return false;
|
| 452 |
+
}
|
| 453 |
+
return true;
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
/**
|
| 457 |
+
* Expand takes the name and asks the server to list all the
|
| 458 |
+
* people who are members of the _list_. Expand will return
|
| 459 |
+
* back and array of the result or false if an error occurs.
|
| 460 |
+
* Each value in the array returned has the format of:
|
| 461 |
+
* [ <full-name> <sp> ] <path>
|
| 462 |
+
* The definition of <path> is defined in rfc 821
|
| 463 |
+
*
|
| 464 |
+
* Implements rfc 821: EXPN <SP> <string> <CRLF>
|
| 465 |
+
*
|
| 466 |
+
* SMTP CODE SUCCESS: 250
|
| 467 |
+
* SMTP CODE FAILURE: 550
|
| 468 |
+
* SMTP CODE ERROR : 500,501,502,504,421
|
| 469 |
+
* @access public
|
| 470 |
+
* @return string array
|
| 471 |
+
*/
|
| 472 |
+
public function Expand($name) {
|
| 473 |
+
$this->error = null; // so no confusion is caused
|
| 474 |
+
|
| 475 |
+
if(!$this->connected()) {
|
| 476 |
+
$this->error = array(
|
| 477 |
+
"error" => "Called Expand() without being connected");
|
| 478 |
+
return false;
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
|
| 482 |
+
|
| 483 |
+
$rply = $this->get_lines();
|
| 484 |
+
$code = substr($rply,0,3);
|
| 485 |
+
|
| 486 |
+
if($this->do_debug >= 2) {
|
| 487 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
if($code != 250) {
|
| 491 |
+
$this->error =
|
| 492 |
+
array("error" => "EXPN not accepted from server",
|
| 493 |
+
"smtp_code" => $code,
|
| 494 |
+
"smtp_msg" => substr($rply,4));
|
| 495 |
+
if($this->do_debug >= 1) {
|
| 496 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 497 |
+
": " . $rply . $this->CRLF;
|
| 498 |
+
}
|
| 499 |
+
return false;
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
// parse the reply and place in our array to return to user
|
| 503 |
+
$entries = explode($this->CRLF,$rply);
|
| 504 |
+
while(list(,$l) = @each($entries)) {
|
| 505 |
+
$list[] = substr($l,4);
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
return $list;
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
/**
|
| 512 |
+
* Sends the HELO command to the smtp server.
|
| 513 |
+
* This makes sure that we and the server are in
|
| 514 |
+
* the same known state.
|
| 515 |
+
*
|
| 516 |
+
* Implements from rfc 821: HELO <SP> <domain> <CRLF>
|
| 517 |
+
*
|
| 518 |
+
* SMTP CODE SUCCESS: 250
|
| 519 |
+
* SMTP CODE ERROR : 500, 501, 504, 421
|
| 520 |
+
* @access public
|
| 521 |
+
* @return bool
|
| 522 |
+
*/
|
| 523 |
+
public function Hello($host="") {
|
| 524 |
+
$this->error = null; // so no confusion is caused
|
| 525 |
+
|
| 526 |
+
if(!$this->connected()) {
|
| 527 |
+
$this->error = array(
|
| 528 |
+
"error" => "Called Hello() without being connected");
|
| 529 |
+
return false;
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
// if a hostname for the HELO was not specified determine
|
| 533 |
+
//a suitable one to send
|
| 534 |
+
if(empty($host)) {
|
| 535 |
+
// we need to determine some sort of appopiate default
|
| 536 |
+
// to send to the server
|
| 537 |
+
$host = "localhost";
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
// Send extended hello first (RFC 2821)
|
| 541 |
+
if(!$this->SendHello("EHLO", $host))
|
| 542 |
+
{
|
| 543 |
+
if(!$this->SendHello("HELO", $host))
|
| 544 |
+
return false;
|
| 545 |
+
}
|
| 546 |
+
|
| 547 |
+
return true;
|
| 548 |
+
}
|
| 549 |
+
|
| 550 |
+
/**
|
| 551 |
+
* Sends a HELO/EHLO command.
|
| 552 |
+
* @access private
|
| 553 |
+
* @return bool
|
| 554 |
+
*/
|
| 555 |
+
private function SendHello($hello, $host) {
|
| 556 |
+
fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
|
| 557 |
+
|
| 558 |
+
$rply = $this->get_lines();
|
| 559 |
+
$code = substr($rply,0,3);
|
| 560 |
+
|
| 561 |
+
if($this->do_debug >= 2) {
|
| 562 |
+
echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
if($code != 250) {
|
| 566 |
+
$this->error =
|
| 567 |
+
array("error" => $hello . " not accepted from server",
|
| 568 |
+
"smtp_code" => $code,
|
| 569 |
+
"smtp_msg" => substr($rply,4));
|
| 570 |
+
if($this->do_debug >= 1) {
|
| 571 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 572 |
+
": " . $rply . $this->CRLF;
|
| 573 |
+
}
|
| 574 |
+
return false;
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
$this->helo_rply = $rply;
|
| 578 |
+
|
| 579 |
+
return true;
|
| 580 |
+
}
|
| 581 |
+
|
| 582 |
+
/**
|
| 583 |
+
* Gets help information on the keyword specified. If the keyword
|
| 584 |
+
* is not specified then returns generic help, ussually contianing
|
| 585 |
+
* A list of keywords that help is available on. This function
|
| 586 |
+
* returns the results back to the user. It is up to the user to
|
| 587 |
+
* handle the returned data. If an error occurs then false is
|
| 588 |
+
* returned with $this->error set appropiately.
|
| 589 |
+
*
|
| 590 |
+
* Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
|
| 591 |
+
*
|
| 592 |
+
* SMTP CODE SUCCESS: 211,214
|
| 593 |
+
* SMTP CODE ERROR : 500,501,502,504,421
|
| 594 |
+
* @access public
|
| 595 |
+
* @return string
|
| 596 |
+
*/
|
| 597 |
+
public function Help($keyword="") {
|
| 598 |
+
$this->error = null; // to avoid confusion
|
| 599 |
+
|
| 600 |
+
if(!$this->connected()) {
|
| 601 |
+
$this->error = array(
|
| 602 |
+
"error" => "Called Help() without being connected");
|
| 603 |
+
return false;
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
$extra = "";
|
| 607 |
+
if(!empty($keyword)) {
|
| 608 |
+
$extra = " " . $keyword;
|
| 609 |
+
}
|
| 610 |
+
|
| 611 |
+
fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
|
| 612 |
+
|
| 613 |
+
$rply = $this->get_lines();
|
| 614 |
+
$code = substr($rply,0,3);
|
| 615 |
+
|
| 616 |
+
if($this->do_debug >= 2) {
|
| 617 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
if($code != 211 && $code != 214) {
|
| 621 |
+
$this->error =
|
| 622 |
+
array("error" => "HELP not accepted from server",
|
| 623 |
+
"smtp_code" => $code,
|
| 624 |
+
"smtp_msg" => substr($rply,4));
|
| 625 |
+
if($this->do_debug >= 1) {
|
| 626 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 627 |
+
": " . $rply . $this->CRLF;
|
| 628 |
+
}
|
| 629 |
+
return false;
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
return $rply;
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
/**
|
| 636 |
+
* Starts a mail transaction from the email address specified in
|
| 637 |
+
* $from. Returns true if successful or false otherwise. If True
|
| 638 |
+
* the mail transaction is started and then one or more Recipient
|
| 639 |
+
* commands may be called followed by a Data command.
|
| 640 |
+
*
|
| 641 |
+
* Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
|
| 642 |
+
*
|
| 643 |
+
* SMTP CODE SUCCESS: 250
|
| 644 |
+
* SMTP CODE SUCCESS: 552,451,452
|
| 645 |
+
* SMTP CODE SUCCESS: 500,501,421
|
| 646 |
+
* @access public
|
| 647 |
+
* @return bool
|
| 648 |
+
*/
|
| 649 |
+
public function Mail($from) {
|
| 650 |
+
$this->error = null; // so no confusion is caused
|
| 651 |
+
|
| 652 |
+
if(!$this->connected()) {
|
| 653 |
+
$this->error = array(
|
| 654 |
+
"error" => "Called Mail() without being connected");
|
| 655 |
+
return false;
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
$useVerp = ($this->do_verp ? "XVERP" : "");
|
| 659 |
+
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
|
| 660 |
+
|
| 661 |
+
$rply = $this->get_lines();
|
| 662 |
+
$code = substr($rply,0,3);
|
| 663 |
+
|
| 664 |
+
if($this->do_debug >= 2) {
|
| 665 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 666 |
+
}
|
| 667 |
+
|
| 668 |
+
if($code != 250) {
|
| 669 |
+
$this->error =
|
| 670 |
+
array("error" => "MAIL not accepted from server",
|
| 671 |
+
"smtp_code" => $code,
|
| 672 |
+
"smtp_msg" => substr($rply,4));
|
| 673 |
+
if($this->do_debug >= 1) {
|
| 674 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 675 |
+
": " . $rply . $this->CRLF;
|
| 676 |
+
}
|
| 677 |
+
return false;
|
| 678 |
+
}
|
| 679 |
+
return true;
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
/**
|
| 683 |
+
* Sends the command NOOP to the SMTP server.
|
| 684 |
+
*
|
| 685 |
+
* Implements from rfc 821: NOOP <CRLF>
|
| 686 |
+
*
|
| 687 |
+
* SMTP CODE SUCCESS: 250
|
| 688 |
+
* SMTP CODE ERROR : 500, 421
|
| 689 |
+
* @access public
|
| 690 |
+
* @return bool
|
| 691 |
+
*/
|
| 692 |
+
public function Noop() {
|
| 693 |
+
$this->error = null; // so no confusion is caused
|
| 694 |
+
|
| 695 |
+
if(!$this->connected()) {
|
| 696 |
+
$this->error = array(
|
| 697 |
+
"error" => "Called Noop() without being connected");
|
| 698 |
+
return false;
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
fputs($this->smtp_conn,"NOOP" . $this->CRLF);
|
| 702 |
+
|
| 703 |
+
$rply = $this->get_lines();
|
| 704 |
+
$code = substr($rply,0,3);
|
| 705 |
+
|
| 706 |
+
if($this->do_debug >= 2) {
|
| 707 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
if($code != 250) {
|
| 711 |
+
$this->error =
|
| 712 |
+
array("error" => "NOOP not accepted from server",
|
| 713 |
+
"smtp_code" => $code,
|
| 714 |
+
"smtp_msg" => substr($rply,4));
|
| 715 |
+
if($this->do_debug >= 1) {
|
| 716 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 717 |
+
": " . $rply . $this->CRLF;
|
| 718 |
+
}
|
| 719 |
+
return false;
|
| 720 |
+
}
|
| 721 |
+
return true;
|
| 722 |
+
}
|
| 723 |
+
|
| 724 |
+
/**
|
| 725 |
+
* Sends the quit command to the server and then closes the socket
|
| 726 |
+
* if there is no error or the $close_on_error argument is true.
|
| 727 |
+
*
|
| 728 |
+
* Implements from rfc 821: QUIT <CRLF>
|
| 729 |
+
*
|
| 730 |
+
* SMTP CODE SUCCESS: 221
|
| 731 |
+
* SMTP CODE ERROR : 500
|
| 732 |
+
* @access public
|
| 733 |
+
* @return bool
|
| 734 |
+
*/
|
| 735 |
+
public function Quit($close_on_error=true) {
|
| 736 |
+
$this->error = null; // so there is no confusion
|
| 737 |
+
|
| 738 |
+
if(!$this->connected()) {
|
| 739 |
+
$this->error = array(
|
| 740 |
+
"error" => "Called Quit() without being connected");
|
| 741 |
+
return false;
|
| 742 |
+
}
|
| 743 |
+
|
| 744 |
+
// send the quit command to the server
|
| 745 |
+
fputs($this->smtp_conn,"quit" . $this->CRLF);
|
| 746 |
+
|
| 747 |
+
// get any good-bye messages
|
| 748 |
+
$byemsg = $this->get_lines();
|
| 749 |
+
|
| 750 |
+
if($this->do_debug >= 2) {
|
| 751 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
$rval = true;
|
| 755 |
+
$e = null;
|
| 756 |
+
|
| 757 |
+
$code = substr($byemsg,0,3);
|
| 758 |
+
if($code != 221) {
|
| 759 |
+
// use e as a tmp var cause Close will overwrite $this->error
|
| 760 |
+
$e = array("error" => "SMTP server rejected quit command",
|
| 761 |
+
"smtp_code" => $code,
|
| 762 |
+
"smtp_rply" => substr($byemsg,4));
|
| 763 |
+
$rval = false;
|
| 764 |
+
if($this->do_debug >= 1) {
|
| 765 |
+
echo "SMTP -> ERROR: " . $e["error"] . ": " .
|
| 766 |
+
$byemsg . $this->CRLF;
|
| 767 |
+
}
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
if(empty($e) || $close_on_error) {
|
| 771 |
+
$this->Close();
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
return $rval;
|
| 775 |
+
}
|
| 776 |
+
|
| 777 |
+
/**
|
| 778 |
+
* Sends the command RCPT to the SMTP server with the TO: argument of $to.
|
| 779 |
+
* Returns true if the recipient was accepted false if it was rejected.
|
| 780 |
+
*
|
| 781 |
+
* Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
|
| 782 |
+
*
|
| 783 |
+
* SMTP CODE SUCCESS: 250,251
|
| 784 |
+
* SMTP CODE FAILURE: 550,551,552,553,450,451,452
|
| 785 |
+
* SMTP CODE ERROR : 500,501,503,421
|
| 786 |
+
* @access public
|
| 787 |
+
* @return bool
|
| 788 |
+
*/
|
| 789 |
+
public function Recipient($to) {
|
| 790 |
+
$this->error = null; // so no confusion is caused
|
| 791 |
+
|
| 792 |
+
if(!$this->connected()) {
|
| 793 |
+
$this->error = array(
|
| 794 |
+
"error" => "Called Recipient() without being connected");
|
| 795 |
+
return false;
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
|
| 799 |
+
|
| 800 |
+
$rply = $this->get_lines();
|
| 801 |
+
$code = substr($rply,0,3);
|
| 802 |
+
|
| 803 |
+
if($this->do_debug >= 2) {
|
| 804 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
if($code != 250 && $code != 251) {
|
| 808 |
+
$this->error =
|
| 809 |
+
array("error" => "RCPT not accepted from server",
|
| 810 |
+
"smtp_code" => $code,
|
| 811 |
+
"smtp_msg" => substr($rply,4));
|
| 812 |
+
if($this->do_debug >= 1) {
|
| 813 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 814 |
+
": " . $rply . $this->CRLF;
|
| 815 |
+
}
|
| 816 |
+
return false;
|
| 817 |
+
}
|
| 818 |
+
return true;
|
| 819 |
+
}
|
| 820 |
+
|
| 821 |
+
/**
|
| 822 |
+
* Sends the RSET command to abort and transaction that is
|
| 823 |
+
* currently in progress. Returns true if successful false
|
| 824 |
+
* otherwise.
|
| 825 |
+
*
|
| 826 |
+
* Implements rfc 821: RSET <CRLF>
|
| 827 |
+
*
|
| 828 |
+
* SMTP CODE SUCCESS: 250
|
| 829 |
+
* SMTP CODE ERROR : 500,501,504,421
|
| 830 |
+
* @access public
|
| 831 |
+
* @return bool
|
| 832 |
+
*/
|
| 833 |
+
public function Reset() {
|
| 834 |
+
$this->error = null; // so no confusion is caused
|
| 835 |
+
|
| 836 |
+
if(!$this->connected()) {
|
| 837 |
+
$this->error = array(
|
| 838 |
+
"error" => "Called Reset() without being connected");
|
| 839 |
+
return false;
|
| 840 |
+
}
|
| 841 |
+
|
| 842 |
+
fputs($this->smtp_conn,"RSET" . $this->CRLF);
|
| 843 |
+
|
| 844 |
+
$rply = $this->get_lines();
|
| 845 |
+
$code = substr($rply,0,3);
|
| 846 |
+
|
| 847 |
+
if($this->do_debug >= 2) {
|
| 848 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
if($code != 250) {
|
| 852 |
+
$this->error =
|
| 853 |
+
array("error" => "RSET failed",
|
| 854 |
+
"smtp_code" => $code,
|
| 855 |
+
"smtp_msg" => substr($rply,4));
|
| 856 |
+
if($this->do_debug >= 1) {
|
| 857 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 858 |
+
": " . $rply . $this->CRLF;
|
| 859 |
+
}
|
| 860 |
+
return false;
|
| 861 |
+
}
|
| 862 |
+
|
| 863 |
+
return true;
|
| 864 |
+
}
|
| 865 |
+
|
| 866 |
+
/**
|
| 867 |
+
* Starts a mail transaction from the email address specified in
|
| 868 |
+
* $from. Returns true if successful or false otherwise. If True
|
| 869 |
+
* the mail transaction is started and then one or more Recipient
|
| 870 |
+
* commands may be called followed by a Data command. This command
|
| 871 |
+
* will send the message to the users terminal if they are logged
|
| 872 |
+
* in.
|
| 873 |
+
*
|
| 874 |
+
* Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
|
| 875 |
+
*
|
| 876 |
+
* SMTP CODE SUCCESS: 250
|
| 877 |
+
* SMTP CODE SUCCESS: 552,451,452
|
| 878 |
+
* SMTP CODE SUCCESS: 500,501,502,421
|
| 879 |
+
* @access public
|
| 880 |
+
* @return bool
|
| 881 |
+
*/
|
| 882 |
+
public function Send($from) {
|
| 883 |
+
$this->error = null; // so no confusion is caused
|
| 884 |
+
|
| 885 |
+
if(!$this->connected()) {
|
| 886 |
+
$this->error = array(
|
| 887 |
+
"error" => "Called Send() without being connected");
|
| 888 |
+
return false;
|
| 889 |
+
}
|
| 890 |
+
|
| 891 |
+
fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
|
| 892 |
+
|
| 893 |
+
$rply = $this->get_lines();
|
| 894 |
+
$code = substr($rply,0,3);
|
| 895 |
+
|
| 896 |
+
if($this->do_debug >= 2) {
|
| 897 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
if($code != 250) {
|
| 901 |
+
$this->error =
|
| 902 |
+
array("error" => "SEND not accepted from server",
|
| 903 |
+
"smtp_code" => $code,
|
| 904 |
+
"smtp_msg" => substr($rply,4));
|
| 905 |
+
if($this->do_debug >= 1) {
|
| 906 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 907 |
+
": " . $rply . $this->CRLF;
|
| 908 |
+
}
|
| 909 |
+
return false;
|
| 910 |
+
}
|
| 911 |
+
return true;
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
+
/**
|
| 915 |
+
* Starts a mail transaction from the email address specified in
|
| 916 |
+
* $from. Returns true if successful or false otherwise. If True
|
| 917 |
+
* the mail transaction is started and then one or more Recipient
|
| 918 |
+
* commands may be called followed by a Data command. This command
|
| 919 |
+
* will send the message to the users terminal if they are logged
|
| 920 |
+
* in and send them an email.
|
| 921 |
+
*
|
| 922 |
+
* Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
|
| 923 |
+
*
|
| 924 |
+
* SMTP CODE SUCCESS: 250
|
| 925 |
+
* SMTP CODE SUCCESS: 552,451,452
|
| 926 |
+
* SMTP CODE SUCCESS: 500,501,502,421
|
| 927 |
+
* @access public
|
| 928 |
+
* @return bool
|
| 929 |
+
*/
|
| 930 |
+
public function SendAndMail($from) {
|
| 931 |
+
$this->error = null; // so no confusion is caused
|
| 932 |
+
|
| 933 |
+
if(!$this->connected()) {
|
| 934 |
+
$this->error = array(
|
| 935 |
+
"error" => "Called SendAndMail() without being connected");
|
| 936 |
+
return false;
|
| 937 |
+
}
|
| 938 |
+
|
| 939 |
+
fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
|
| 940 |
+
|
| 941 |
+
$rply = $this->get_lines();
|
| 942 |
+
$code = substr($rply,0,3);
|
| 943 |
+
|
| 944 |
+
if($this->do_debug >= 2) {
|
| 945 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 946 |
+
}
|
| 947 |
+
|
| 948 |
+
if($code != 250) {
|
| 949 |
+
$this->error =
|
| 950 |
+
array("error" => "SAML not accepted from server",
|
| 951 |
+
"smtp_code" => $code,
|
| 952 |
+
"smtp_msg" => substr($rply,4));
|
| 953 |
+
if($this->do_debug >= 1) {
|
| 954 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 955 |
+
": " . $rply . $this->CRLF;
|
| 956 |
+
}
|
| 957 |
+
return false;
|
| 958 |
+
}
|
| 959 |
+
return true;
|
| 960 |
+
}
|
| 961 |
+
|
| 962 |
+
/**
|
| 963 |
+
* Starts a mail transaction from the email address specified in
|
| 964 |
+
* $from. Returns true if successful or false otherwise. If True
|
| 965 |
+
* the mail transaction is started and then one or more Recipient
|
| 966 |
+
* commands may be called followed by a Data command. This command
|
| 967 |
+
* will send the message to the users terminal if they are logged
|
| 968 |
+
* in or mail it to them if they are not.
|
| 969 |
+
*
|
| 970 |
+
* Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
|
| 971 |
+
*
|
| 972 |
+
* SMTP CODE SUCCESS: 250
|
| 973 |
+
* SMTP CODE SUCCESS: 552,451,452
|
| 974 |
+
* SMTP CODE SUCCESS: 500,501,502,421
|
| 975 |
+
* @access public
|
| 976 |
+
* @return bool
|
| 977 |
+
*/
|
| 978 |
+
public function SendOrMail($from) {
|
| 979 |
+
$this->error = null; // so no confusion is caused
|
| 980 |
+
|
| 981 |
+
if(!$this->connected()) {
|
| 982 |
+
$this->error = array(
|
| 983 |
+
"error" => "Called SendOrMail() without being connected");
|
| 984 |
+
return false;
|
| 985 |
+
}
|
| 986 |
+
|
| 987 |
+
fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
|
| 988 |
+
|
| 989 |
+
$rply = $this->get_lines();
|
| 990 |
+
$code = substr($rply,0,3);
|
| 991 |
+
|
| 992 |
+
if($this->do_debug >= 2) {
|
| 993 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 994 |
+
}
|
| 995 |
+
|
| 996 |
+
if($code != 250) {
|
| 997 |
+
$this->error =
|
| 998 |
+
array("error" => "SOML not accepted from server",
|
| 999 |
+
"smtp_code" => $code,
|
| 1000 |
+
"smtp_msg" => substr($rply,4));
|
| 1001 |
+
if($this->do_debug >= 1) {
|
| 1002 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 1003 |
+
": " . $rply . $this->CRLF;
|
| 1004 |
+
}
|
| 1005 |
+
return false;
|
| 1006 |
+
}
|
| 1007 |
+
return true;
|
| 1008 |
+
}
|
| 1009 |
+
|
| 1010 |
+
/**
|
| 1011 |
+
* This is an optional command for SMTP that this class does not
|
| 1012 |
+
* support. This method is here to make the RFC821 Definition
|
| 1013 |
+
* complete for this class and __may__ be implimented in the future
|
| 1014 |
+
*
|
| 1015 |
+
* Implements from rfc 821: TURN <CRLF>
|
| 1016 |
+
*
|
| 1017 |
+
* SMTP CODE SUCCESS: 250
|
| 1018 |
+
* SMTP CODE FAILURE: 502
|
| 1019 |
+
* SMTP CODE ERROR : 500, 503
|
| 1020 |
+
* @access public
|
| 1021 |
+
* @return bool
|
| 1022 |
+
*/
|
| 1023 |
+
public function Turn() {
|
| 1024 |
+
$this->error = array("error" => "This method, TURN, of the SMTP ".
|
| 1025 |
+
"is not implemented");
|
| 1026 |
+
if($this->do_debug >= 1) {
|
| 1027 |
+
echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
|
| 1028 |
+
}
|
| 1029 |
+
return false;
|
| 1030 |
+
}
|
| 1031 |
+
|
| 1032 |
+
/**
|
| 1033 |
+
* Verifies that the name is recognized by the server.
|
| 1034 |
+
* Returns false if the name could not be verified otherwise
|
| 1035 |
+
* the response from the server is returned.
|
| 1036 |
+
*
|
| 1037 |
+
* Implements rfc 821: VRFY <SP> <string> <CRLF>
|
| 1038 |
+
*
|
| 1039 |
+
* SMTP CODE SUCCESS: 250,251
|
| 1040 |
+
* SMTP CODE FAILURE: 550,551,553
|
| 1041 |
+
* SMTP CODE ERROR : 500,501,502,421
|
| 1042 |
+
* @access public
|
| 1043 |
+
* @return int
|
| 1044 |
+
*/
|
| 1045 |
+
public function Verify($name) {
|
| 1046 |
+
$this->error = null; // so no confusion is caused
|
| 1047 |
+
|
| 1048 |
+
if(!$this->connected()) {
|
| 1049 |
+
$this->error = array(
|
| 1050 |
+
"error" => "Called Verify() without being connected");
|
| 1051 |
+
return false;
|
| 1052 |
+
}
|
| 1053 |
+
|
| 1054 |
+
fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
|
| 1055 |
+
|
| 1056 |
+
$rply = $this->get_lines();
|
| 1057 |
+
$code = substr($rply,0,3);
|
| 1058 |
+
|
| 1059 |
+
if($this->do_debug >= 2) {
|
| 1060 |
+
echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
|
| 1061 |
+
}
|
| 1062 |
+
|
| 1063 |
+
if($code != 250 && $code != 251) {
|
| 1064 |
+
$this->error =
|
| 1065 |
+
array("error" => "VRFY failed on name '$name'",
|
| 1066 |
+
"smtp_code" => $code,
|
| 1067 |
+
"smtp_msg" => substr($rply,4));
|
| 1068 |
+
if($this->do_debug >= 1) {
|
| 1069 |
+
echo "SMTP -> ERROR: " . $this->error["error"] .
|
| 1070 |
+
": " . $rply . $this->CRLF;
|
| 1071 |
+
}
|
| 1072 |
+
return false;
|
| 1073 |
+
}
|
| 1074 |
+
return $rply;
|
| 1075 |
+
}
|
| 1076 |
+
|
| 1077 |
+
/*******************************************************************
|
| 1078 |
+
* INTERNAL FUNCTIONS *
|
| 1079 |
+
******************************************************************/
|
| 1080 |
+
|
| 1081 |
+
/**
|
| 1082 |
+
* Read in as many lines as possible
|
| 1083 |
+
* either before eof or socket timeout occurs on the operation.
|
| 1084 |
+
* With SMTP we can tell if we have more lines to read if the
|
| 1085 |
+
* 4th character is '-' symbol. If it is a space then we don't
|
| 1086 |
+
* need to read anything else.
|
| 1087 |
+
* @access private
|
| 1088 |
+
* @return string
|
| 1089 |
+
*/
|
| 1090 |
+
private function get_lines() {
|
| 1091 |
+
$data = "";
|
| 1092 |
+
while($str = @fgets($this->smtp_conn,515)) {
|
| 1093 |
+
if($this->do_debug >= 4) {
|
| 1094 |
+
echo "SMTP -> get_lines(): \$data was \"$data\"" .
|
| 1095 |
+
$this->CRLF;
|
| 1096 |
+
echo "SMTP -> get_lines(): \$str is \"$str\"" .
|
| 1097 |
+
$this->CRLF;
|
| 1098 |
+
}
|
| 1099 |
+
$data .= $str;
|
| 1100 |
+
if($this->do_debug >= 4) {
|
| 1101 |
+
echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
|
| 1102 |
+
}
|
| 1103 |
+
// if the 4th character is a space then we are done reading
|
| 1104 |
+
// so just break the loop
|
| 1105 |
+
if(substr($str,3,1) == " ") { break; }
|
| 1106 |
+
}
|
| 1107 |
+
return $data;
|
| 1108 |
+
}
|
| 1109 |
+
|
| 1110 |
+
}
|
| 1111 |
+
|
| 1112 |
+
|
| 1113 |
+
?>
|
app/code/community/MageTracking/TicketSystem/Helper/Ticket.php
ADDED
|
@@ -0,0 +1,789 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
|
| 5 |
+
* Sofhere SofTicket Magento Component
|
| 6 |
+
|
| 7 |
+
*
|
| 8 |
+
|
| 9 |
+
* NOTICE OF LICENSE
|
| 10 |
+
|
| 11 |
+
*
|
| 12 |
+
|
| 13 |
+
* This source file is subject to the GNU (3.0)
|
| 14 |
+
|
| 15 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 16 |
+
|
| 17 |
+
* It is also available through the world-wide-web at this URL:
|
| 18 |
+
|
| 19 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 20 |
+
|
| 21 |
+
* If you did not receive a copy of the license and are unable to
|
| 22 |
+
|
| 23 |
+
* obtain it through the world-wide-web, please send an email
|
| 24 |
+
|
| 25 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 26 |
+
|
| 27 |
+
*
|
| 28 |
+
|
| 29 |
+
* @category design_default
|
| 30 |
+
|
| 31 |
+
* @author sofhere.com
|
| 32 |
+
|
| 33 |
+
* @package Sofhere_SofTicket
|
| 34 |
+
|
| 35 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 36 |
+
|
| 37 |
+
* @version 1.0
|
| 38 |
+
|
| 39 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 40 |
+
|
| 41 |
+
*/
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
require_once 'Mail_data.php';
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class Ticket {
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
/* ID of the ticket.
|
| 58 |
+
|
| 59 |
+
* @var int
|
| 60 |
+
|
| 61 |
+
*/
|
| 62 |
+
|
| 63 |
+
public $id = 0;
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
/* Name of the person filling out the ticket.
|
| 70 |
+
|
| 71 |
+
* @var int
|
| 72 |
+
|
| 73 |
+
*/
|
| 74 |
+
|
| 75 |
+
public $name = '';
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
|
| 81 |
+
* Email of the person filling out the ticket.
|
| 82 |
+
|
| 83 |
+
* @var int
|
| 84 |
+
|
| 85 |
+
*/
|
| 86 |
+
|
| 87 |
+
public $email = '';
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
|
| 93 |
+
* Phone of the person filling out the ticket.
|
| 94 |
+
|
| 95 |
+
* @var int
|
| 96 |
+
|
| 97 |
+
*/
|
| 98 |
+
|
| 99 |
+
public $phone = '';
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
|
| 105 |
+
* Category of the ticket.
|
| 106 |
+
|
| 107 |
+
* @var int
|
| 108 |
+
|
| 109 |
+
*/
|
| 110 |
+
|
| 111 |
+
public $category = 0;
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
|
| 117 |
+
* Email priority (1 = High, 2 = Normal, 3 = low).
|
| 118 |
+
|
| 119 |
+
* @var int
|
| 120 |
+
|
| 121 |
+
*/
|
| 122 |
+
|
| 123 |
+
public $priority = 2;
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
|
| 129 |
+
* IP of the client.
|
| 130 |
+
|
| 131 |
+
* @var int
|
| 132 |
+
|
| 133 |
+
*/
|
| 134 |
+
|
| 135 |
+
public $ip = '';
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
|
| 141 |
+
* Message coming the first time from the user.
|
| 142 |
+
|
| 143 |
+
* @var int
|
| 144 |
+
|
| 145 |
+
*/
|
| 146 |
+
|
| 147 |
+
public $message = '';
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
|
| 153 |
+
* Subject of the Message.
|
| 154 |
+
|
| 155 |
+
* @var int
|
| 156 |
+
|
| 157 |
+
*/
|
| 158 |
+
|
| 159 |
+
public $subject = '';
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
|
| 165 |
+
* Subject of the Message.
|
| 166 |
+
|
| 167 |
+
* @var int
|
| 168 |
+
|
| 169 |
+
*/
|
| 170 |
+
|
| 171 |
+
public $timestamp = '';
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
function create($sendmail = TRUE) {
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
if ($this->id && $this->priority && $this->category && $this->subject && $this->name && $this->email){
|
| 184 |
+
|
| 185 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
if (($this->ip != '') && ($_SERVER['REMOTE_ADDR'] != ''))
|
| 190 |
+
|
| 191 |
+
$this->ip = $_SERVER['REMOTE_ADDR'];
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
if (($this->priority == '') || ($this->priority < 0 || $this->priority > 3))
|
| 196 |
+
|
| 197 |
+
$this->priority = 2;
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
$this->priority = preg_replace('/\D+/', '', $this->priority); //sanitise
|
| 202 |
+
|
| 203 |
+
$this->category = preg_replace('/\D+/', '', $this->category); //sanitise
|
| 204 |
+
|
| 205 |
+
$this->timestamp = now();
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
// insert a new ticket...
|
| 212 |
+
|
| 213 |
+
$model = Mage::getModel('ticketsystem/ticketsystem');
|
| 214 |
+
|
| 215 |
+
$model->setData('ID',$this->id);
|
| 216 |
+
|
| 217 |
+
$model->setData('subject',$this->subject);
|
| 218 |
+
|
| 219 |
+
$model->setData('name',$this->name);
|
| 220 |
+
|
| 221 |
+
$model->setData('email',strtolower($this->email));
|
| 222 |
+
|
| 223 |
+
$model->setData('cat',$this->category);
|
| 224 |
+
|
| 225 |
+
$model->setData('priority',$this->priority);
|
| 226 |
+
|
| 227 |
+
$model->setData('phone',$this->phone);
|
| 228 |
+
|
| 229 |
+
$model->setData('orders',$this->orders);
|
| 230 |
+
|
| 231 |
+
$model->setData('ip',$this->ip);
|
| 232 |
+
|
| 233 |
+
$model->setData('message',$this->message);
|
| 234 |
+
|
| 235 |
+
$model->setData('timestamp',$this->timestamp);
|
| 236 |
+
|
| 237 |
+
$model->save();
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
$c = Mage::getModel('ticketsystem/cats')->load($this->category);
|
| 242 |
+
|
| 243 |
+
$mailsubj = $db_settings['ticket_subj'];
|
| 244 |
+
|
| 245 |
+
$mailmsg = $db_settings['ticket_msg'];
|
| 246 |
+
|
| 247 |
+
$signature= $c->getData('signature');
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
if ($sendmail) { //should we send?
|
| 252 |
+
|
| 253 |
+
$mail=new Mail_data();
|
| 254 |
+
|
| 255 |
+
$mail->sendEmail($this->id, $this->subject, $this->name, $this->email, $c, $this->priority, $this->message,$mailsubj, $mailmsg, $signature);
|
| 256 |
+
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
return true;
|
| 260 |
+
|
| 261 |
+
}else
|
| 262 |
+
|
| 263 |
+
return false;
|
| 264 |
+
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
|
| 271 |
+
function close($ticketID) {
|
| 272 |
+
|
| 273 |
+
$this->changeStatus($ticketID, 'closed');
|
| 274 |
+
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
function reopen($ticketID) {
|
| 278 |
+
|
| 279 |
+
$this->changeStatus($ticketID, 'reopened');
|
| 280 |
+
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
function putonHold($ticketID) {
|
| 284 |
+
|
| 285 |
+
$this->changeStatus($ticketID, 'onhold');
|
| 286 |
+
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
function delete($ticketID) {
|
| 290 |
+
|
| 291 |
+
$ticketID = preg_replace('/\D+/', '', $ticketID); //sanitise
|
| 292 |
+
|
| 293 |
+
// delete ticket
|
| 294 |
+
|
| 295 |
+
$model = Mage::getModel('ticketsystem/ticketsystem');
|
| 296 |
+
|
| 297 |
+
$model->setId($ticketID)->delete();
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
// delete messages
|
| 302 |
+
|
| 303 |
+
$model = Mage::getModel('ticketsystem/messages');
|
| 304 |
+
|
| 305 |
+
$model->setTicket($ticketID)->delete();
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
// delete answers
|
| 310 |
+
|
| 311 |
+
$model = Mage::getModel('ticketsystem/answers');
|
| 312 |
+
|
| 313 |
+
foreach ($model->getCollection()->addFieldToFilter('ticket',$ticketID)->load() as $item){
|
| 314 |
+
|
| 315 |
+
$ans_id=$item->getData('ID');
|
| 316 |
+
|
| 317 |
+
if ($ans_id){
|
| 318 |
+
|
| 319 |
+
Mage::getModel('ticketsystem/answers')
|
| 320 |
+
|
| 321 |
+
->setId($ans_id)
|
| 322 |
+
|
| 323 |
+
->delete();
|
| 324 |
+
|
| 325 |
+
}
|
| 326 |
+
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
function changeStatus($ticketId, $status){
|
| 334 |
+
|
| 335 |
+
$ticketId = preg_replace('/\D+/', '', $ticketId); //sanitise
|
| 336 |
+
|
| 337 |
+
$model = Mage::getModel('ticketsystem/ticketsystem')->load($ticketId);
|
| 338 |
+
|
| 339 |
+
$model->setData('status',$status);
|
| 340 |
+
|
| 341 |
+
$model->update();
|
| 342 |
+
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
function changeRep($ticketId, $repId){
|
| 348 |
+
|
| 349 |
+
$ticketId = preg_replace('/\D+/', '', $ticketId); //sanitise
|
| 350 |
+
|
| 351 |
+
$model = Mage::getModel('ticketsystem/ticketsystem')->load($ticketId);
|
| 352 |
+
|
| 353 |
+
$model->setData('rep',$repId);
|
| 354 |
+
|
| 355 |
+
$model->update();
|
| 356 |
+
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
function postMessage($ticketId, $message, $header = '', $notifyuser = true, $newstatus = 'new') {
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
$ticketId = preg_replace('/\D+/', '', $ticketId); //sanitise
|
| 370 |
+
|
| 371 |
+
$errors = array();
|
| 372 |
+
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
$this->reopen($ticketId);
|
| 376 |
+
|
| 377 |
+
$header = $db_settings['save_headers'] ? $header : '';
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
$model = Mage::getModel('ticketsystem/messages');
|
| 382 |
+
|
| 383 |
+
$model->setData('headers',$header);
|
| 384 |
+
|
| 385 |
+
$model->setData('message',$message);
|
| 386 |
+
|
| 387 |
+
$model->setData('ticket',$ticketId);
|
| 388 |
+
|
| 389 |
+
$model->setData('timestamp',now());
|
| 390 |
+
|
| 391 |
+
$id=$model->save()->getId();
|
| 392 |
+
|
| 393 |
+
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
|
| 397 |
+
//update ticket status
|
| 398 |
+
|
| 399 |
+
$this->changeStatus($ticketId, $newstatus);
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
if ($db_settings['alert_new']) {
|
| 404 |
+
|
| 405 |
+
$mail = new Mail_data();
|
| 406 |
+
|
| 407 |
+
$mail->emailAlert($ticketId, $id);
|
| 408 |
+
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
if ($db_settings['message_response'] && $notifyuser) {
|
| 412 |
+
|
| 413 |
+
$t = Mage::getModel('ticketsystem/ticketsystem')->load($ticketId);
|
| 414 |
+
|
| 415 |
+
$c = Mage::getModel('ticketsystem/cats')->load($t->getData('cat'));
|
| 416 |
+
|
| 417 |
+
|
| 418 |
+
|
| 419 |
+
$mailsubj = $db_settings['message_subj'];
|
| 420 |
+
|
| 421 |
+
$mailmsg = $db_settings['message_msg'];
|
| 422 |
+
|
| 423 |
+
$signature= $c->getData('signature');
|
| 424 |
+
|
| 425 |
+
$mail=new Mail_data();
|
| 426 |
+
|
| 427 |
+
$mail->sendEmail($t->getData('ID'), $t->getData('subject'), $t->getData('name'), $t->getData('email'), $c, $t->getData('priority'), $t->getData('message'), $mailsubj, $mailmsg, $signature);
|
| 428 |
+
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
function postAnswer($message, $repid, $rep_name, $ticketid, $newstatus) {
|
| 434 |
+
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 438 |
+
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
$msg_res = Mage::getModel('ticketsystem/messages')->load($ticketid,'ticket');
|
| 442 |
+
|
| 443 |
+
$msgid= $msg_res->getData('ID');
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
$t = Mage::getModel('ticketsystem/ticketsystem')->load($ticketid);
|
| 448 |
+
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
$this->changeStatus($ticketid, $newstatus);
|
| 452 |
+
|
| 453 |
+
if (! ($rep_name == 'Administrator')) {
|
| 454 |
+
|
| 455 |
+
if($repid > 0)
|
| 456 |
+
|
| 457 |
+
$this->changeRep($ticketid, $repid);
|
| 458 |
+
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
$answers=Mage::getModel('ticketsystem/answers');
|
| 464 |
+
|
| 465 |
+
$answers->setData('ticket',$ticketid);
|
| 466 |
+
|
| 467 |
+
$answers->setData('message',$message);
|
| 468 |
+
|
| 469 |
+
$answers->setData('reference',$msgid);
|
| 470 |
+
|
| 471 |
+
$answers->setData('rep',$repid);
|
| 472 |
+
|
| 473 |
+
$answers->save();
|
| 474 |
+
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
$catid=$t->getData('cat');
|
| 478 |
+
|
| 479 |
+
$cat_res=Mage::getModel('ticketsystem/cats')->load($catid);
|
| 480 |
+
|
| 481 |
+
$answer_subj = $db_settings['answer_subj'];
|
| 482 |
+
|
| 483 |
+
$answer_msg = $db_settings['answer_msg'];
|
| 484 |
+
|
| 485 |
+
$signature= $cat_res->getData('signature');
|
| 486 |
+
|
| 487 |
+
$mail=new Mail_data();
|
| 488 |
+
|
| 489 |
+
$mail->sendEmail($ticketid, $t->getData('subject'), $t->getData('name'), $t->getData('email'), $cat_res, $t->getData('priority'), $message, $answer_subj, $answer_msg, $signature, true);
|
| 490 |
+
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
function postPrivMessage($ticket, $repid, $msg) {
|
| 498 |
+
|
| 499 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 500 |
+
|
| 501 |
+
$id = preg_replace('/\D+/', '', $id); //sanitise
|
| 502 |
+
|
| 503 |
+
$errors = array();
|
| 504 |
+
|
| 505 |
+
$model=Mage::getModel('ticketsystem/privmsg');
|
| 506 |
+
|
| 507 |
+
$model->setData('ticket',$ticket);
|
| 508 |
+
|
| 509 |
+
$model->setData('rep',$repid);
|
| 510 |
+
|
| 511 |
+
$model->setData('message',$msg);
|
| 512 |
+
|
| 513 |
+
$model->setData('timestamp',now());
|
| 514 |
+
|
| 515 |
+
$model->save();
|
| 516 |
+
|
| 517 |
+
return $errors ? $errors : $id;
|
| 518 |
+
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
|
| 524 |
+
|
| 525 |
+
function transCatTicket($tid, $cid, $add_msg = false, $alert = false) {
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
|
| 529 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 530 |
+
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
$tid = preg_replace('/\D+/', '', $tid); //sanitise
|
| 534 |
+
|
| 535 |
+
$cid = preg_replace('/\D+/', '', $cid); //sanitise
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
|
| 539 |
+
$add_msg = $add_msg ? ': ' . $add_msg : '';
|
| 540 |
+
|
| 541 |
+
$add_msg = preg_replace("/%20/", " ", $add_msg);
|
| 542 |
+
|
| 543 |
+
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
|
| 547 |
+
$model=Mage::getModel('ticketsystem/ticketsystem')->load($tid);
|
| 548 |
+
|
| 549 |
+
$catFrom=Mage::getModel('ticketsystem/cats')->load($model->getData('cat'));
|
| 550 |
+
|
| 551 |
+
$cat2=Mage::getModel('ticketsystem/cats')->load($cid);
|
| 552 |
+
|
| 553 |
+
$trans_msg = 'From ' . $catFrom->getData('name') . ' ' . ' (' . format_time($db_settings['time_format']) . ') ' . $add_msg;
|
| 554 |
+
|
| 555 |
+
$model->setData('cat',$cid);
|
| 556 |
+
|
| 557 |
+
$model->setData('trans_msg', $trans_msg);
|
| 558 |
+
|
| 559 |
+
$model->update();
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
if ($db_settings['trans_response'] && !$cat2->getData('hidden') && $alert) {
|
| 564 |
+
|
| 565 |
+
$trans_subj = $db_settings['trans_subj'];
|
| 566 |
+
|
| 567 |
+
$trans_msg = $db_settings['trans_msg'];
|
| 568 |
+
|
| 569 |
+
$vars = array();
|
| 570 |
+
|
| 571 |
+
$vars['ticket'] = $tid;
|
| 572 |
+
|
| 573 |
+
$vars['subject'] = $model->getData('subject');
|
| 574 |
+
|
| 575 |
+
$vars['category'] = $cat2->getData('name');
|
| 576 |
+
|
| 577 |
+
$vars['cat_name'] = $cat2->getData('name');
|
| 578 |
+
|
| 579 |
+
$vars['name'] = $model->getData('name');
|
| 580 |
+
|
| 581 |
+
$vars['email'] = $model->getData('email');
|
| 582 |
+
|
| 583 |
+
$vars['status'] = $model->getData('status');
|
| 584 |
+
|
| 585 |
+
$vars['trans_msg'] = $add_msg;
|
| 586 |
+
|
| 587 |
+
//$trans_msg = addRemoveTag($trans_msg, $db_settings);
|
| 588 |
+
|
| 589 |
+
$trans_msg = addSig($cat2->getData('signature'), $trans_msg, $db_settings);
|
| 590 |
+
|
| 591 |
+
$trans_subj = keywords($trans_subj, $vars, $db_settings);
|
| 592 |
+
|
| 593 |
+
$text = keywords($trans_msg, $vars,$db_settings);
|
| 594 |
+
|
| 595 |
+
if ($html = getHTML($trans_msg, $vars, 'email-example.html',$db_settings)) {
|
| 596 |
+
|
| 597 |
+
$body = array();
|
| 598 |
+
|
| 599 |
+
$body['text'] = $text;
|
| 600 |
+
|
| 601 |
+
$body['html'] = $html;
|
| 602 |
+
|
| 603 |
+
} else {
|
| 604 |
+
|
| 605 |
+
$body = $text;
|
| 606 |
+
|
| 607 |
+
}
|
| 608 |
+
|
| 609 |
+
//notify user
|
| 610 |
+
|
| 611 |
+
$from = '"' . $cat2->getData('name') . '" <' . $cat2->getData('email') . '>';
|
| 612 |
+
|
| 613 |
+
$mail=new Mail_data();
|
| 614 |
+
|
| 615 |
+
//$mail->sendEmail($tid,$model->getData('subject'),$model->getData('name'),$model->getData('email'), $cat2, $model->getData('priority'),$add_msg,$trans_subj,$text,'',true);
|
| 616 |
+
send_mail($model->getData('email'), $trans_subj, $body, $from, $model->getData('priority'),$db_settings);
|
| 617 |
+
//notify admin
|
| 618 |
+
|
| 619 |
+
$from = $db_settings['alert_email'];
|
| 620 |
+
|
| 621 |
+
$mail=new Mail_data();
|
| 622 |
+
|
| 623 |
+
foreach($mail->getEmails($cat2->getData('ID')) as $to) {
|
| 624 |
+
|
| 625 |
+
if (!empty($to)) {
|
| 626 |
+
|
| 627 |
+
$mail=new Mail_data();
|
| 628 |
+
|
| 629 |
+
send_mail($to, $trans_subj, $body, $from, $model->getData('priority'),$db_settings);
|
| 630 |
+
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
}
|
| 636 |
+
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
|
| 640 |
+
|
| 641 |
+
|
| 642 |
+
|
| 643 |
+
function transRepTicket($tid, $rid, $alert = false, $rep_name) {
|
| 644 |
+
|
| 645 |
+
$db_settings=Mage::helper('ticketsystem')->getMailDBSettings();
|
| 646 |
+
|
| 647 |
+
// Fetch Admin user details
|
| 648 |
+
$query = "SELECT * from admin_user where user_id=$rid";
|
| 649 |
+
$data = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($query);
|
| 650 |
+
|
| 651 |
+
$tid = preg_replace('/\D+/', '', $tid); //sanitise
|
| 652 |
+
|
| 653 |
+
$rid = preg_replace('/\D+/', '', $rid); //sanitise
|
| 654 |
+
|
| 655 |
+
if (empty($tid)) {
|
| 656 |
+
|
| 657 |
+
return;
|
| 658 |
+
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
if (empty($rid)) {
|
| 662 |
+
|
| 663 |
+
return;
|
| 664 |
+
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
|
| 668 |
+
|
| 669 |
+
$model=Mage::getModel('ticketsystem/ticketsystem')->load($tid);
|
| 670 |
+
|
| 671 |
+
$repFrom=Mage::getModel('ticketsystem/reps')->load($model->getData('rep'));
|
| 672 |
+
|
| 673 |
+
$rep2=Mage::getModel('ticketsystem/reps')->load($rid);
|
| 674 |
+
|
| 675 |
+
$model->setData('rep',$rid);
|
| 676 |
+
|
| 677 |
+
$model->update();
|
| 678 |
+
|
| 679 |
+
|
| 680 |
+
|
| 681 |
+
if ($db_settings['rep_trans_response'] && $alert) {
|
| 682 |
+
|
| 683 |
+
$trans_subj = $db_settings['rep_trans_subj'];
|
| 684 |
+
|
| 685 |
+
|
| 686 |
+
|
| 687 |
+
$trans_msg = $db_settings['rep_trans_msg'];
|
| 688 |
+
|
| 689 |
+
$vars = array();
|
| 690 |
+
|
| 691 |
+
$vars['ticket'] = $tid;
|
| 692 |
+
|
| 693 |
+
$vars['subject'] = $model->getData('subject');
|
| 694 |
+
|
| 695 |
+
$vars['rep_name'] = $data[0]['firstname']." ".$data[0]['lastname'];
|
| 696 |
+
|
| 697 |
+
$vars['name'] = $model->getData('name');
|
| 698 |
+
|
| 699 |
+
$vars['email'] = $model->getData('email');
|
| 700 |
+
|
| 701 |
+
$vars['status'] = $model->getData('status');
|
| 702 |
+
|
| 703 |
+
$trans_subj = keywords($trans_subj, $vars, $db_settings);
|
| 704 |
+
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
$text = keywords($trans_msg, $vars, $db_settings);
|
| 708 |
+
|
| 709 |
+
if ($html = getHTML($trans_msg, $vars, 'email-example.html', $db_settings)) {
|
| 710 |
+
|
| 711 |
+
$body = array();
|
| 712 |
+
|
| 713 |
+
$body['text'] = $text;
|
| 714 |
+
|
| 715 |
+
$body['html'] = $html;
|
| 716 |
+
|
| 717 |
+
} else {
|
| 718 |
+
|
| 719 |
+
$body = $text;
|
| 720 |
+
|
| 721 |
+
}
|
| 722 |
+
|
| 723 |
+
|
| 724 |
+
|
| 725 |
+
//notify admin
|
| 726 |
+
|
| 727 |
+
$from = $db_settings['alert_email'];
|
| 728 |
+
if (empty($from)) {
|
| 729 |
+
$user = Mage::getSingleton('admin/session');
|
| 730 |
+
$from = $user->getUser()->getEmail();
|
| 731 |
+
}
|
| 732 |
+
|
| 733 |
+
$emails = array();
|
| 734 |
+
|
| 735 |
+
|
| 736 |
+
|
| 737 |
+
// alert_users need to be alerted
|
| 738 |
+
|
| 739 |
+
if (!empty($db_settings['alert_user'])) {
|
| 740 |
+
|
| 741 |
+
$emails = explode(';', $db_settings['alert_user']);
|
| 742 |
+
|
| 743 |
+
}
|
| 744 |
+
|
| 745 |
+
// The rep who is being transferred from needs to be alerted
|
| 746 |
+
|
| 747 |
+
if ($repFrom->getData('email')) {
|
| 748 |
+
|
| 749 |
+
$emails[] = $repFrom->getData('email');
|
| 750 |
+
|
| 751 |
+
}
|
| 752 |
+
|
| 753 |
+
// The rep who is being transferred to needs to be alerted
|
| 754 |
+
|
| 755 |
+
if ($rep2->getData('email')) {
|
| 756 |
+
|
| 757 |
+
$emails[] = $rep2->getData('email');
|
| 758 |
+
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
// Check the Admin email
|
| 762 |
+
if (!empty($data)) {
|
| 763 |
+
$emails[] = $data[0]['email'];
|
| 764 |
+
}
|
| 765 |
+
|
| 766 |
+
// Ensure we don't send to the same email address twice
|
| 767 |
+
|
| 768 |
+
$emails = array_unique($emails);
|
| 769 |
+
|
| 770 |
+
|
| 771 |
+
foreach($emails as $to) {
|
| 772 |
+
|
| 773 |
+
if (!empty($to)) {
|
| 774 |
+
|
| 775 |
+
send_mail($to, $trans_subj, $body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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**********************************************************************************
|
| 3 |
+
* eTicket � http://www.eticketsupport.com *
|
| 4 |
+
* by Digital Frontiers, UTO *
|
| 5 |
+
***********************************************************************************
|
| 6 |
+
* Software Version: eTicket 1.7.3 *
|
| 7 |
+
* Software by: Digital Frontiers, UTO (http://www.eticketsupport.com) *
|
| 8 |
+
* Copyright 2008 by: Digital Frontiers, UTO (http://www.eticketsupport.com) *
|
| 9 |
+
* Support, News, Updates at: http://www.eticketsupport.com *
|
| 10 |
+
***********************************************************************************
|
| 11 |
+
* This program is free software; you may redistribute it and/or modify it under *
|
| 12 |
+
* the terms of the provided license as published by Digital Frontiers, UTO. *
|
| 13 |
+
* *
|
| 14 |
+
* This program is distributed in the hope that it is and will be useful, but *
|
| 15 |
+
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
|
| 16 |
+
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
| 17 |
+
* *
|
| 18 |
+
* See the "license.txt" file for details of the eTicket license. *
|
| 19 |
+
* The latest version can always be found at http://www.eticketsupport.com. *
|
| 20 |
+
**********************************************************************************/
|
| 21 |
+
|
| 22 |
+
//Note: Moved some of the standard functions in here...
|
| 23 |
+
/* Clean Input (html2text,text2html) Start */
|
| 24 |
+
function clean_input($input, $type = 'text') {
|
| 25 |
+
$output = $input;
|
| 26 |
+
if ($type == 'html') {
|
| 27 |
+
$output = html2text($output);
|
| 28 |
+
}
|
| 29 |
+
$output = text2html($output);
|
| 30 |
+
return $output;
|
| 31 |
+
}
|
| 32 |
+
function html2text($html) { //basic version -- borrowed in part from chuggnutt
|
| 33 |
+
preg_match('/<\s*body\s*\/?>(.*?)<\s*\/\s*body\s*\/?\s*>/is', $html, $match);
|
| 34 |
+
if (!empty($match[1])) {
|
| 35 |
+
$text = $match[1];
|
| 36 |
+
} else {
|
| 37 |
+
$text = $html;
|
| 38 |
+
}
|
| 39 |
+
$text = trim($text);
|
| 40 |
+
$search = array("/\r/", // Non-legal carriage return
|
| 41 |
+
"/[\n\t]+/", // Newlines and tabs
|
| 42 |
+
'/[ ]{2,}/', // Runs of spaces, pre-handling
|
| 43 |
+
'/<script[^>]*>.*?<\/script>/i', // <script>s -- which strip_tags supposedly has problems with
|
| 44 |
+
'/<style[^>]*>.*?<\/style>/i', // <style>s -- which strip_tags supposedly has problems with
|
| 45 |
+
'/<img [^>]*alt="([^"]+)"[^>]*>/ie', // <img>s
|
| 46 |
+
'/<a [^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/ie',
|
| 47 |
+
// <a href="">
|
| 48 |
+
'/<h[123][^>]*>(.*?)<\/h[123]>/ie', // H1 - H3
|
| 49 |
+
'/<h[456][^>]*>(.*?)<\/h[456]>/ie', // H4 - H6
|
| 50 |
+
'/<p[^>]*>/i', // <P>
|
| 51 |
+
'/<br\\\\s*?\\/??>/i', // <br>
|
| 52 |
+
'/<b[^>]*>(.*?)<\/b>/ie', // <b>
|
| 53 |
+
'/<strong[^>]*>(.*?)<\/strong>/ie', // <strong>
|
| 54 |
+
'/<i[^>]*>(.*?)<\/i>/i', // <i>
|
| 55 |
+
'/<em[^>]*>(.*?)<\/em>/i', // <em>
|
| 56 |
+
'/(<ul[^>]*>|<\/ul>)/i', // <ul> and </ul>
|
| 57 |
+
'/(<ol[^>]*>|<\/ol>)/i', // <ol> and </ol>
|
| 58 |
+
'/<li[^>]*>(.*?)<\/li>/i', // <li> and </li>
|
| 59 |
+
'/<li[^>]*>/i', // <li>
|
| 60 |
+
'/<hr[^>]*>/i', // <hr>
|
| 61 |
+
'/(<table[^>]*>|<\/table>)/i', // <table> and </table>
|
| 62 |
+
'/(<tr[^>]*>|<\/tr>)/i', // <tr> and </tr>
|
| 63 |
+
'/<td[^>]*>(.*?)<\/td>/i', // <td> and </td>
|
| 64 |
+
'/<th[^>]*>(.*?)<\/th>/ie', // <th> and </th>
|
| 65 |
+
'/&(nbsp|#160);/i', // Non-breaking space
|
| 66 |
+
'/&(quot|rdquo|ldquo|#8220|#8221|#147|#148);/i',
|
| 67 |
+
// Double quotes
|
| 68 |
+
'/&(apos|rsquo|lsquo|#8216|#8217);/i', // Single quotes
|
| 69 |
+
'/>/i', // Greater-than
|
| 70 |
+
'/</i', // Less-than
|
| 71 |
+
'/&(amp|#38);/i', // Ampersand
|
| 72 |
+
'/&(copy|#169);/i', // Copyright
|
| 73 |
+
'/&(trade|#8482|#153);/i', // Trademark
|
| 74 |
+
'/&(reg|#174);/i', // Registered
|
| 75 |
+
'/&(mdash|#151|#8212);/i', // mdash
|
| 76 |
+
'/&(ndash|minus|#8211|#8722);/i', // ndash
|
| 77 |
+
'/&(bull|#149|#8226);/i', // Bullet
|
| 78 |
+
'/&(pound|#163);/i', // Pound sign
|
| 79 |
+
'/&(euro|#8364);/i', // Euro sign
|
| 80 |
+
'/&[^&;]+;/i', // Unknown/unhandled entities
|
| 81 |
+
'/[ ]{2,}/'
|
| 82 |
+
// Runs of spaces, post-handling
|
| 83 |
+
);
|
| 84 |
+
$replace = array('', // Non-legal carriage return
|
| 85 |
+
' ', // Newlines and tabs
|
| 86 |
+
' ', // Runs of spaces, pre-handling
|
| 87 |
+
'', // <script>s -- which strip_tags supposedly has problems with
|
| 88 |
+
'', // <style>s -- which strip_tags supposedly has problems with
|
| 89 |
+
'trim("\\1")', // <img>s
|
| 90 |
+
'html2link("\\1","\\2")',
|
| 91 |
+
// <a href=""> 1=link 2=text
|
| 92 |
+
"strtoupper(\"\n\n\\1\n\n\")", // H1 - H3
|
| 93 |
+
"ucwords(\"\n\n\\1\n\n\")", // H4 - H6
|
| 94 |
+
"\n\n\t", // <P>
|
| 95 |
+
"\n", // <br>
|
| 96 |
+
'strtoupper("\\1")', // <b>
|
| 97 |
+
'strtoupper("\\1")', // <strong>
|
| 98 |
+
'_\\1_', // <i>
|
| 99 |
+
'_\\1_', // <em>
|
| 100 |
+
"\n\n", // <ul> and </ul>
|
| 101 |
+
"\n\n", // <ol> and </ol>
|
| 102 |
+
"\t* \\1\n", // <li> and </li>
|
| 103 |
+
"\n\t* ", // <li>
|
| 104 |
+
"\n-------------------------\n", // <hr>
|
| 105 |
+
"\n\n", // <table> and </table>
|
| 106 |
+
"\n", // <tr> and </tr>
|
| 107 |
+
"\t\t\\1\n", // <td> and </td>
|
| 108 |
+
"strtoupper(\"\t\t\\1\n\")", // <th> and </th>
|
| 109 |
+
' ', // Non-breaking space
|
| 110 |
+
'"', // Double quotes
|
| 111 |
+
"'", // Single quotes
|
| 112 |
+
'>', '<', '&', '(c)', '(tm)', '(R)', '--', '-', '*', '�', 'EUR', // Euro sign. � ?
|
| 113 |
+
'', // Unknown/unhandled entities
|
| 114 |
+
' '
|
| 115 |
+
// Runs of spaces, post-handling
|
| 116 |
+
);
|
| 117 |
+
// Run search-and-replace
|
| 118 |
+
$text = preg_replace($search, $replace, $text);
|
| 119 |
+
// Strip any other HTML tags that may have been missed
|
| 120 |
+
$text = strip_tags($text);
|
| 121 |
+
// Bring down number of empty lines to 2 max
|
| 122 |
+
$text = preg_replace("/\n\s+\n/", "\n\n", $text);
|
| 123 |
+
$text = preg_replace("/[\n]{3,}/", "\n\n", $text);
|
| 124 |
+
return $text;
|
| 125 |
+
}
|
| 126 |
+
function html2link($link, $text) {
|
| 127 |
+
$text = trim(htmlspecialchars($text));
|
| 128 |
+
$link = trim(htmlentities($link));
|
| 129 |
+
if (!empty($text)) {
|
| 130 |
+
$link = trim("$link $text");
|
| 131 |
+
}
|
| 132 |
+
return "[$link]";
|
| 133 |
+
}
|
| 134 |
+
function text2html($text) {
|
| 135 |
+
$html = $text; //first step to converting text to html
|
| 136 |
+
$html = htmlspecialchars_decode($html);
|
| 137 |
+
$html = htmlspecialchars($html);
|
| 138 |
+
$html = nl2br($html); //turn new lines to <br>s
|
| 139 |
+
$html = link2html($html); //create html links
|
| 140 |
+
return $html;
|
| 141 |
+
}
|
| 142 |
+
function link2html($text) { //borrowed in part from wordpress
|
| 143 |
+
$text = preg_replace("/\[\[(.*?)[ ]{1}(.*?)\]\]/i", '<a href="\\1">\\2</a>', $text);
|
| 144 |
+
$text = preg_replace("/\[(.*?)[ ]{1}(.*?)\]/i", '<a href="\\1">\\2</a>', $text);
|
| 145 |
+
$text = preg_replace(array('#([\s>])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is', '#([\s>])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is', '#([\s>])([a-z0-9\-_.]+)@([^,< \n\r]+)#i'), array('$1<a href="$2" rel="nofollow">$2</a>', '$1<a href="http://$2" rel="nofollow">$2</a>', '$1<a href="mailto:$2@$3">$2@$3</a>'), $text);
|
| 146 |
+
$text = preg_replace("#(<a( [^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i", "$1$3</a>", $text);
|
| 147 |
+
$text = trim($text);
|
| 148 |
+
return $text;
|
| 149 |
+
}
|
| 150 |
+
if (!function_exists('remove_trailing_slash')) {
|
| 151 |
+
function remove_trailing_slash($dir, $slash = DIRECTORY_SEPARATOR) {
|
| 152 |
+
if (substr($dir, -1) == $slash) {
|
| 153 |
+
$dir = substr($dir, 0, -1);
|
| 154 |
+
}
|
| 155 |
+
return $dir;
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
if (!function_exists('add_trailing_slash')) {
|
| 159 |
+
function add_trailing_slash($dir, $slash = DIRECTORY_SEPARATOR) {
|
| 160 |
+
if (substr($dir, -1) != $slash) {
|
| 161 |
+
$dir = $dir . $slash;
|
| 162 |
+
}
|
| 163 |
+
return $dir;
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
function escape_string($value, $quotes = true) {
|
| 167 |
+
$value = trim($value);
|
| 168 |
+
$value = get_magic_quotes_gpc() ? stripslashes($value) : $value;
|
| 169 |
+
if (!(is_numeric($value) && intval($value) == $value)) {
|
| 170 |
+
if (function_exists('mysql_real_escape_string')) {
|
| 171 |
+
$value = mysql_real_escape_string($value);
|
| 172 |
+
} else {
|
| 173 |
+
$value = addslashes($value);
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
if ($quotes == true) {
|
| 177 |
+
$value = "'$value'";
|
| 178 |
+
}
|
| 179 |
+
return $value;
|
| 180 |
+
}
|
| 181 |
+
function escape_array($array) {
|
| 182 |
+
$new = array();
|
| 183 |
+
foreach($array as $key => $val) {
|
| 184 |
+
$new[$key] = escape_string($val);
|
| 185 |
+
}
|
| 186 |
+
return $new;
|
| 187 |
+
}
|
| 188 |
+
function trim_post($array) { //$array is for array of post keys
|
| 189 |
+
foreach($array as $key) {
|
| 190 |
+
if (isset($_POST[$key])) {
|
| 191 |
+
$_POST[$key] = trim($_POST[$key]);
|
| 192 |
+
}
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
if (!function_exists('array_combine')) {
|
| 196 |
+
function array_combine($keys, $vals) {
|
| 197 |
+
$keys = array_values((array)$keys);
|
| 198 |
+
$vals = array_values((array)$vals);
|
| 199 |
+
$n = max(count($keys), count($vals));
|
| 200 |
+
$r = array();
|
| 201 |
+
for ($i = 0;$i < $n;$i++) {
|
| 202 |
+
$r[$keys[$i]] = $vals[$i];
|
| 203 |
+
}
|
| 204 |
+
return $r;
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
//upload function: name of form file field,destination filename,max file size,file types(.ext or mi/me)
|
| 208 |
+
function upload_file($file, $dest = '', $maxsize = '99999', $types = array(), $errors = array('nodata' => 'No uploaded file data', 'empty' => 'Empty uploaded file data', 'toolong' => 'Filename is too long', 'invalidpath' => 'Upload path is invalid', 'pathwrite' => 'Upload path is NOT writable', 'nofile' => 'Not an uploaded file', 'invalidtype' => 'Invalid file type', 'toosmall' => 'File is too small', 'toobig' => 'File is too big', 'exists' => 'File already exists', 'failed' => 'Upload failed')) {
|
| 209 |
+
if (empty($dest)) {
|
| 210 |
+
$dest = './' . $file['name'];
|
| 211 |
+
}
|
| 212 |
+
if (!isset($file)) {
|
| 213 |
+
return $errors['nodata'];
|
| 214 |
+
}
|
| 215 |
+
if (empty($file)) {
|
| 216 |
+
return $errors['empty'];
|
| 217 |
+
}
|
| 218 |
+
if (strlen($file['name']) > 60) {
|
| 219 |
+
return $errors['toolong'];
|
| 220 |
+
}
|
| 221 |
+
if ($file['error'] != 0) {
|
| 222 |
+
return $file['error'];
|
| 223 |
+
}
|
| 224 |
+
if (!is_dir(dirname($dest))) {
|
| 225 |
+
return $errors['invalidpath'];
|
| 226 |
+
}
|
| 227 |
+
if (!is_writeable(dirname($dest))) {
|
| 228 |
+
return $errors['pathwrite'];
|
| 229 |
+
}
|
| 230 |
+
if (!is_uploaded_file($file['tmp_name'])) {
|
| 231 |
+
return $errors['nofile'];
|
| 232 |
+
}
|
| 233 |
+
if (!check_file_types($file['name'], $types)) {
|
| 234 |
+
return $errors['invalidtype'];
|
| 235 |
+
}
|
| 236 |
+
if ($file['size'] == 0) {
|
| 237 |
+
return $errors['toosmall'];
|
| 238 |
+
}
|
| 239 |
+
if ($file['size'] > $maxsize) {
|
| 240 |
+
return $errors['toobig'];
|
| 241 |
+
}
|
| 242 |
+
if (file_exists($dest)) {
|
| 243 |
+
return $errors['exists'];
|
| 244 |
+
}
|
| 245 |
+
if (!@copy($file['tmp_name'], $dest)) {
|
| 246 |
+
return $errors['failed'];
|
| 247 |
+
}
|
| 248 |
+
@unlink($file['tmp_name']);
|
| 249 |
+
return 0;
|
| 250 |
+
}
|
| 251 |
+
function check_file_types($file, $types = array()) {
|
| 252 |
+
if (!empty($types)) {
|
| 253 |
+
foreach($types as $type) {
|
| 254 |
+
if (strstr($type, '/')) {
|
| 255 |
+
if (strtolower(mime_content_type($file)) == strtolower($type)) {
|
| 256 |
+
return TRUE;
|
| 257 |
+
}
|
| 258 |
+
} else {
|
| 259 |
+
if (strtolower(get_ext($file)) == strtolower($type)) {
|
| 260 |
+
return TRUE;
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
if (!function_exists('mime_content_type')) {
|
| 267 |
+
function mime_content_type($filename) {
|
| 268 |
+
$finfo = finfo_open(FILEINFO_MIME);
|
| 269 |
+
$mimetype = finfo_file($finfo, $filename);
|
| 270 |
+
finfo_close($finfo);
|
| 271 |
+
return $mimetype;
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
function get_ext($file) { //returns .ext, ie: .jpg
|
| 275 |
+
if (strstr($file, '.')) {
|
| 276 |
+
$ext = substr($file, strrpos($file, '.'));
|
| 277 |
+
return $ext;
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
function is_email($email) { //returns email address if it's valid
|
| 281 |
+
$pattern = '/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/';
|
| 282 |
+
if (preg_match($pattern, $email)) {
|
| 283 |
+
if (getmx_from_email($email)) {
|
| 284 |
+
return $email;
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
// support windows platforms
|
| 289 |
+
if (!function_exists('getmxrr')) {
|
| 290 |
+
if ((isset($_ENV['OS'])) && ($_ENV['OS'] == 'Windows_NT')) {
|
| 291 |
+
function getmxrr($hostname, &$mxhosts, &$mxweight) {
|
| 292 |
+
if (!is_array($mxhosts)) {
|
| 293 |
+
$mxhosts = array();
|
| 294 |
+
}
|
| 295 |
+
if (!empty($hostname)) {
|
| 296 |
+
$output = '';
|
| 297 |
+
$exec = 'nslookup.exe -q=mx ' . escapeshellarg($hostname);
|
| 298 |
+
@exec($exec, $output);
|
| 299 |
+
$imx = -1;
|
| 300 |
+
foreach($output as $line) {
|
| 301 |
+
$imx++;
|
| 302 |
+
$parts = "";
|
| 303 |
+
if (preg_match("/^$hostname\tMX preference = ([0-9]+), mail exchanger = (.*)$/", $line, $parts)) {
|
| 304 |
+
$mxweight[$imx] = trim($parts[1]);
|
| 305 |
+
$mxhosts[$imx] = trim($parts[2]);
|
| 306 |
+
}
|
| 307 |
+
if (preg_match("/responsible mail addr = (.*)/", $line, $parts)) {
|
| 308 |
+
$mxweight[$imx] = $imx;
|
| 309 |
+
$mxhosts[$imx] = trim($parts[1]);
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
return ($imx != -1);
|
| 313 |
+
}
|
| 314 |
+
return false;
|
| 315 |
+
}
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
function getmx_from_email($email) {
|
| 319 |
+
list($user, $hostname) = split('@', $email);
|
| 320 |
+
return getmx($hostname);
|
| 321 |
+
}
|
| 322 |
+
function getmx($hostname) {
|
| 323 |
+
getmxrr($hostname, $mxhosts, $mxweight); //check for a true MX record
|
| 324 |
+
$mx = array_shift($mxhosts); // get the first MX record
|
| 325 |
+
if (!empty($mx)) {
|
| 326 |
+
return $mx;
|
| 327 |
+
} else { // RFC says use the A line if there is no MX
|
| 328 |
+
$ip = gethostbyname($hostname); // get the ip from hostname
|
| 329 |
+
if ($ip != $hostname) { // continue if returned ip not hostname
|
| 330 |
+
$hostname = gethostbyaddr($ip); // get the rdns (real) hostname
|
| 331 |
+
$ip = gethostbyname($hostname); // check the (real) hostname has an A record
|
| 332 |
+
if ($ip != $hostname) { // continue if returned ip not hostname
|
| 333 |
+
return $hostname;
|
| 334 |
+
}
|
| 335 |
+
}
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
//This function was introduced to provide better handling of emails
|
| 340 |
+
//The $body is on the understanding that it's plain text and will be converted to HTML
|
| 341 |
+
function send_mail($to, $subject, $body, $from, $priority = 2, $db_settings) { //v0.3
|
| 342 |
+
|
| 343 |
+
include_once ('Phpmailer.php');
|
| 344 |
+
$mail = new Phpmailer();
|
| 345 |
+
$from_name='';
|
| 346 |
+
$from_email='';
|
| 347 |
+
$to_name='';
|
| 348 |
+
$to_email='';
|
| 349 |
+
|
| 350 |
+
if ($to[0] == ':') {
|
| 351 |
+
return false;
|
| 352 |
+
} // this email address is disabled
|
| 353 |
+
|
| 354 |
+
if (preg_match('/(.+)<(.+)>/i', $from, $matches)) {
|
| 355 |
+
if (!empty($matches[1])) {
|
| 356 |
+
$from_name = trim($matches[1]);
|
| 357 |
+
}
|
| 358 |
+
if (!empty($matches[2])) {
|
| 359 |
+
$from_email = trim($matches[2]);
|
| 360 |
+
}
|
| 361 |
+
}
|
| 362 |
+
if (empty($from_email)) {
|
| 363 |
+
$from_email = $from;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
if (preg_match('/(.+)<(.+)>/i', $to, $matches)) {
|
| 367 |
+
if (!empty($matches[1])) {
|
| 368 |
+
$to_name = trim($matches[1]);
|
| 369 |
+
}
|
| 370 |
+
if (!empty($matches[2])) {
|
| 371 |
+
$to_email = trim($matches[2]);
|
| 372 |
+
}
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
if (empty($to_email)) {
|
| 376 |
+
$to_email = $to;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
if (is_array($body)) {
|
| 380 |
+
if (!empty($body['html'])) {
|
| 381 |
+
$mail->IsHTML(true);
|
| 382 |
+
$mail->Body = $body['html'];
|
| 383 |
+
$htmlbody = $body['html'];
|
| 384 |
+
}
|
| 385 |
+
if (!empty($body['text'])) {
|
| 386 |
+
$mail->AltBody = $body['text'];
|
| 387 |
+
$body = $body['text'];
|
| 388 |
+
}
|
| 389 |
+
} else {
|
| 390 |
+
$mail->Body = $body;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
# Priority?
|
| 394 |
+
if ($priority == 3) {
|
| 395 |
+
$pri = 1;
|
| 396 |
+
} elseif ($priority == 1) {
|
| 397 |
+
$pri = 5;
|
| 398 |
+
} else {
|
| 399 |
+
$pri = 3;
|
| 400 |
+
}
|
| 401 |
+
$db_settings['mail_method'] = "mail";
|
| 402 |
+
//print_r($db_settings['mail_method']);die();
|
| 403 |
+
# SEND THE EMAIL
|
| 404 |
+
if ($db_settings['mail_method'] == "smtp") {
|
| 405 |
+
$mail->IsSMTP();
|
| 406 |
+
$mail->Host = $db_settings['smtp_host'];
|
| 407 |
+
$mail->Port = $db_settings['smtp_port'];
|
| 408 |
+
$mail->Helo = $_SERVER['SERVER_NAME'];
|
| 409 |
+
if ($db_settings['smtp_auth'] == "1") {
|
| 410 |
+
$mail->SMTPAuth = TRUE;
|
| 411 |
+
$mail->Username = $db_settings['smtp_user'];
|
| 412 |
+
$mail->Password = $db_settings['smtp_pass'];
|
| 413 |
+
}
|
| 414 |
+
} elseif ($db_settings['mail_method'] == "mail") {
|
| 415 |
+
$mail->IsMail();
|
| 416 |
+
} else {
|
| 417 |
+
$mail->IsSendmail();
|
| 418 |
+
$mail->Sendmail = $db_settings['sendmail_path'];
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
$mail->Hostname = $_SERVER['SERVER_NAME'];
|
| 422 |
+
$mail->From = $from_email;
|
| 423 |
+
$mail->FromName = str_replace('"', '', $from_name);
|
| 424 |
+
$mail->Subject = $subject;
|
| 425 |
+
$mail->AddAddress($to_email, $to_name);
|
| 426 |
+
$mail->Priority = $pri;
|
| 427 |
+
$mail->CharSet = $db_settings['charset'];
|
| 428 |
+
if(!$mail->Send()) {
|
| 429 |
+
$mail_sent = FALSE;
|
| 430 |
+
} else {
|
| 431 |
+
$mail_sent = TRUE;
|
| 432 |
+
}
|
| 433 |
+
return $mail_sent;
|
| 434 |
+
}
|
| 435 |
+
function size_readable($size, $retstring = null) { //returns a human readable filesize
|
| 436 |
+
if ((!is_numeric($size)) && (file_exists($size))) {
|
| 437 |
+
$size = filesize($size);
|
| 438 |
+
}
|
| 439 |
+
$sizes = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
| 440 |
+
if ($retstring === null) {
|
| 441 |
+
$retstring = '%01.2f %s';
|
| 442 |
+
}
|
| 443 |
+
$lastsizestring = end($sizes);
|
| 444 |
+
foreach($sizes as $sizestring) {
|
| 445 |
+
if ($size < 1024) {
|
| 446 |
+
break;
|
| 447 |
+
}
|
| 448 |
+
if ($sizestring != $lastsizestring) {
|
| 449 |
+
$size/= 1024;
|
| 450 |
+
}
|
| 451 |
+
}
|
| 452 |
+
if ($sizestring == $sizes[0]) {
|
| 453 |
+
$retstring = '%01d %s';
|
| 454 |
+
} // Bytes aren't normally fractional
|
| 455 |
+
return sprintf($retstring, $size, $sizestring);
|
| 456 |
+
}
|
| 457 |
+
function format_time($format, $time = false) {
|
| 458 |
+
if (preg_match('/%/', $format)) {
|
| 459 |
+
if ($time) {
|
| 460 |
+
return strftime($format, $time);
|
| 461 |
+
} else {
|
| 462 |
+
return strftime($format);
|
| 463 |
+
}
|
| 464 |
+
}
|
| 465 |
+
if ($time) {
|
| 466 |
+
return date($format, $time);
|
| 467 |
+
} else {
|
| 468 |
+
return date($format);
|
| 469 |
+
}
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
|
| 473 |
+
|
| 474 |
+
function getdirs($dir) {
|
| 475 |
+
$ignore = array('.', '..', 'index.php');
|
| 476 |
+
$files = array();
|
| 477 |
+
if ($handle = opendir($dir)) {
|
| 478 |
+
while (false !== ($file = readdir($handle))) {
|
| 479 |
+
if (!in_array($file, $ignore)) {
|
| 480 |
+
if (is_dir($dir . $file)) {
|
| 481 |
+
$files[] = $file;
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
}
|
| 485 |
+
closedir($handle);
|
| 486 |
+
}
|
| 487 |
+
return $files;
|
| 488 |
+
}
|
| 489 |
+
if (!function_exists('htmlspecialchars_decode')) {
|
| 490 |
+
function htmlspecialchars_decode($text) {
|
| 491 |
+
return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
function htmlspecialchars_array($arr = array()) {
|
| 496 |
+
$rs = array();
|
| 497 |
+
while (list($key, $val) = each($arr)) {
|
| 498 |
+
if (is_array($val)) {
|
| 499 |
+
$rs[$key] = htmlspecialchars_array($val);
|
| 500 |
+
} else {
|
| 501 |
+
$rs[$key] = htmlspecialchars($val, ENT_QUOTES);
|
| 502 |
+
}
|
| 503 |
+
}
|
| 504 |
+
return $rs;
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
function keywords($input, $vars, $db_settings) {
|
| 509 |
+
$vars['url'] = $db_settings['root_url'];
|
| 510 |
+
foreach($vars as $key => $val) {
|
| 511 |
+
$input = str_replace("%$key", $val, $input);
|
| 512 |
+
}
|
| 513 |
+
return $input;
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
function getHTML($message, $vars, $template = 'email-example.html', $db_settings) {
|
| 517 |
+
$theme_dir=Mage::getBaseDir().'/app/code/local/MageTracking/TicketSystem/Helper/';
|
| 518 |
+
if (file_exists($theme_dir . $template)) {
|
| 519 |
+
$html = file_get_contents($theme_dir . $template);
|
| 520 |
+
$message = keywords($message, $vars, $db_settings);
|
| 521 |
+
$message = text2html($message);
|
| 522 |
+
$html = str_replace('%%MSG%%', $message, $html);
|
| 523 |
+
foreach($vars as $key => $val) {
|
| 524 |
+
$vars[$key] = htmlspecialchars($val);
|
| 525 |
+
}
|
| 526 |
+
$html = keywords($html, $vars, $db_settings);
|
| 527 |
+
return $html;
|
| 528 |
+
}
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
function addRemoveTag($msg, $db_settings) {
|
| 532 |
+
if ((isset($db_settings['remove_original'])) && (!empty($db_settings['remove_tag']))) {
|
| 533 |
+
$msg = $db_settings['remove_tag'] . "\n\n" . $msg;
|
| 534 |
+
}
|
| 535 |
+
return $msg;
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
function addSig($sig, $msg ,$db_settings) {
|
| 539 |
+
|
| 540 |
+
if (!empty($sig)) {
|
| 541 |
+
$sig = "\n" . $db_settings['presig'] . $sig;
|
| 542 |
+
$sig = str_replace("\r", "\n", $sig);
|
| 543 |
+
$sig = str_replace("\n\n", "\n", $sig);
|
| 544 |
+
$msg.= $sig;
|
| 545 |
+
}
|
| 546 |
+
return $msg;
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
|
| 550 |
+
?>
|
app/code/community/MageTracking/TicketSystem/Helper/email-example.html
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
| 2 |
+
|
| 3 |
+
<html>
|
| 4 |
+
|
| 5 |
+
<head>
|
| 6 |
+
|
| 7 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
| 8 |
+
|
| 9 |
+
<title>Email</title>
|
| 10 |
+
|
| 11 |
+
<style type="text/css">
|
| 12 |
+
|
| 13 |
+
<!--
|
| 14 |
+
|
| 15 |
+
/* Default Style */
|
| 16 |
+
|
| 17 |
+
BODY {
|
| 18 |
+
|
| 19 |
+
font-family: Verdana, Arial;
|
| 20 |
+
|
| 21 |
+
font-size: 12px;
|
| 22 |
+
|
| 23 |
+
color: #000000;
|
| 24 |
+
|
| 25 |
+
background: #FFFFFF;
|
| 26 |
+
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
P {
|
| 30 |
+
|
| 31 |
+
padding-left: 10px;
|
| 32 |
+
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
BLOCKQUOTE {
|
| 36 |
+
|
| 37 |
+
margin: 10px 20px 0px 20px;
|
| 38 |
+
|
| 39 |
+
padding: 10px;
|
| 40 |
+
|
| 41 |
+
border: 1px solid #8d8d8d;
|
| 42 |
+
|
| 43 |
+
background-color: #f5f5f5;
|
| 44 |
+
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
LI {
|
| 48 |
+
|
| 49 |
+
margin-top: 4px;
|
| 50 |
+
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
UL LI UL LI {
|
| 54 |
+
|
| 55 |
+
margin-top: 2px;
|
| 56 |
+
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
A, A:active, A:link, A:visited {
|
| 60 |
+
|
| 61 |
+
color: #EFB55C;
|
| 62 |
+
|
| 63 |
+
text-decoration: none;
|
| 64 |
+
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
A:hover {
|
| 68 |
+
|
| 69 |
+
color: #5577a5;
|
| 70 |
+
|
| 71 |
+
text-decoration: underline;
|
| 72 |
+
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/* Title Style */
|
| 76 |
+
|
| 77 |
+
H1 {
|
| 78 |
+
|
| 79 |
+
font-family: Verdana, Arial;
|
| 80 |
+
|
| 81 |
+
font-size: 18px;
|
| 82 |
+
|
| 83 |
+
font-weight: bold;
|
| 84 |
+
|
| 85 |
+
color: #F8981D;
|
| 86 |
+
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
H2 {
|
| 90 |
+
|
| 91 |
+
font-family: Verdana, Arial;
|
| 92 |
+
|
| 93 |
+
font-size: 16px;
|
| 94 |
+
|
| 95 |
+
font-weight: bold;
|
| 96 |
+
|
| 97 |
+
color: #EFB55C;
|
| 98 |
+
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
H3 {
|
| 102 |
+
|
| 103 |
+
font-family: Verdana, Arial;
|
| 104 |
+
|
| 105 |
+
font-size: 14px;
|
| 106 |
+
|
| 107 |
+
font-weight: bold;
|
| 108 |
+
|
| 109 |
+
color: #F3C378;
|
| 110 |
+
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
#Container {
|
| 114 |
+
|
| 115 |
+
width: 80%;
|
| 116 |
+
|
| 117 |
+
margin-left: auto;
|
| 118 |
+
|
| 119 |
+
margin-right: auto;
|
| 120 |
+
|
| 121 |
+
text-align: center;
|
| 122 |
+
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
#Content {
|
| 126 |
+
|
| 127 |
+
background-color: #fafafa;
|
| 128 |
+
|
| 129 |
+
border: 1px solid #F8981D;
|
| 130 |
+
|
| 131 |
+
padding: 10px;
|
| 132 |
+
|
| 133 |
+
text-align: left;
|
| 134 |
+
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/* Footer */
|
| 138 |
+
|
| 139 |
+
#Footer {
|
| 140 |
+
|
| 141 |
+
text-align: center;
|
| 142 |
+
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
-->
|
| 146 |
+
|
| 147 |
+
</style>
|
| 148 |
+
|
| 149 |
+
</head>
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
<body>
|
| 154 |
+
|
| 155 |
+
<div id="Container">
|
| 156 |
+
|
| 157 |
+
<p>This message was sent to you via <a href="http://www.sofhere.com/">Magento Custom Component and Project Development Company</a></p>
|
| 158 |
+
|
| 159 |
+
<div id="Content">
|
| 160 |
+
|
| 161 |
+
<h2>%subject</h2>
|
| 162 |
+
|
| 163 |
+
%%MSG%%
|
| 164 |
+
|
| 165 |
+
</div>
|
| 166 |
+
|
| 167 |
+
<p class="Footer"><a href="http://www.eticketsupport.com/">Supported by eTicket</a>. All Rights Reserved.</p>
|
| 168 |
+
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
</body>
|
| 172 |
+
|
| 173 |
+
</html>
|
| 174 |
+
|
app/code/community/MageTracking/TicketSystem/Model/Answers.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Answers extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/answers');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Cats.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Cats extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/cats');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Groups.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Groups extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/groups');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mail.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mail extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/mail');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Messages.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Messages extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/messages');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Answers.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Answers extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the id refers to the key field in your database table.
|
| 8 |
+
$this->_init('ticketsystem/answers', 'id');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Answers/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Answers_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/answers');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Cats.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Cats extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the id refers to the key field in your database table.
|
| 8 |
+
$this->_init('ticketsystem/cats', 'ID');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Cats/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Cats_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/cats');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Groups.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Groups extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the id refers to the key field in your database table.
|
| 8 |
+
$this->_init('ticketsystem/groups', 'ID');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Groups/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Groups_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/groups');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Mail.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Mail extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the id refers to the key field in your database table.
|
| 8 |
+
$this->_init('ticketsystem/mail', 'ID');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Mail/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Mail_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/mail');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Messages.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Messages extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the id refers to the key field in your database table.
|
| 8 |
+
$this->_init('ticketsystem/messages', 'ticket');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
public function save(Mage_Core_Model_Abstract $object)
|
| 13 |
+
{
|
| 14 |
+
$this->_beforeSave($object);
|
| 15 |
+
$this->_checkUnique($object);
|
| 16 |
+
|
| 17 |
+
$this->_getWriteAdapter()->insert($this->getMainTable(), $this->_prepareDataForSave($object));
|
| 18 |
+
$object->setId($this->_getWriteAdapter()->lastInsertId($this->getMainTable()));
|
| 19 |
+
|
| 20 |
+
$this->_afterSave($object);
|
| 21 |
+
|
| 22 |
+
return $this;
|
| 23 |
+
}
|
| 24 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Settings.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Settings extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the id refers to the key field in your database table.
|
| 8 |
+
$this->_init('ticketsystem/settings', 'ID');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Settings/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Settings_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/settings');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Ticketsystem.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Ticketsystem extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
// Note that the softicket_id refers to the key field in your database table.
|
| 8 |
+
$this->_init('ticketsystem/ticketsystem', 'ID');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Mysql4/Ticketsystem/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Mysql4_Ticketsystem_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/ticketsystem');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Settings.php
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Settings extends Mage_Core_Model_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('ticketsystem/settings');
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Status.php
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class MageTracking_TicketSystem_Model_Status extends Varien_Object
|
| 4 |
+
{
|
| 5 |
+
const STATUS_EMPTY = '';
|
| 6 |
+
const STATUS_NEW = 'new';
|
| 7 |
+
const STATUS_ONHOLD = 'onhold';
|
| 8 |
+
const STATUS_CUSTREPLIED = 'custreplied';
|
| 9 |
+
const STATUS_AWAITING = 'awaitingcustomer';
|
| 10 |
+
const STATUS_REOPENED = 'reopened';
|
| 11 |
+
const STATUS_CLOSED = 'closed';
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
static public function getOptionArray()
|
| 15 |
+
{
|
| 16 |
+
return array(
|
| 17 |
+
self::STATUS_EMPTY => Mage::helper('ticketsystem')->__(''),
|
| 18 |
+
self::STATUS_NEW => Mage::helper('ticketsystem')->__('New'),
|
| 19 |
+
self::STATUS_ONHOLD => Mage::helper('ticketsystem')->__('On Hold'),
|
| 20 |
+
self::STATUS_CUSTREPLIED => Mage::helper('ticketsystem')->__('Customer Replied'),
|
| 21 |
+
self::STATUS_AWAITING => Mage::helper('ticketsystem')->__('Awaiting Customer'),
|
| 22 |
+
self::STATUS_REOPENED => Mage::helper('ticketsystem')->__('Reopened'),
|
| 23 |
+
self::STATUS_CLOSED => Mage::helper('ticketsystem')->__('Closed'),
|
| 24 |
+
);
|
| 25 |
+
}
|
| 26 |
+
}
|
app/code/community/MageTracking/TicketSystem/Model/Ticketsystem.php
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class MageTracking_TicketSystem_Model_Ticketsystem extends Mage_Core_Model_Abstract
|
| 6 |
+
|
| 7 |
+
{
|
| 8 |
+
|
| 9 |
+
public function _construct()
|
| 10 |
+
|
| 11 |
+
{
|
| 12 |
+
|
| 13 |
+
parent::_construct();
|
| 14 |
+
|
| 15 |
+
$this->_init('ticketsystem/ticketsystem');
|
| 16 |
+
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
public function getAllTickets($customerId){
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
$customer = Mage::getModel('customer/customer');
|
| 28 |
+
|
| 29 |
+
if ($customerId) {
|
| 30 |
+
|
| 31 |
+
$customer->load($customerId);
|
| 32 |
+
|
| 33 |
+
$email = $customer->getEmail();
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
// Get softickets for this customer with the email...
|
| 38 |
+
|
| 39 |
+
$resource = Mage::getSingleton('core/resource');
|
| 40 |
+
|
| 41 |
+
$read= $resource->getConnection('core_read');
|
| 42 |
+
|
| 43 |
+
$ticketsystem = $resource->getTableName('mticketing_tickets');
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
$select = $read->select()
|
| 48 |
+
|
| 49 |
+
->from($ticketsystem,array('ID','email','subject','status','timestamp', 'cat', 'priority'))
|
| 50 |
+
|
| 51 |
+
->where('email='."'".$email."'")
|
| 52 |
+
|
| 53 |
+
->order('timestamp DESC') ;
|
| 54 |
+
|
| 55 |
+
return $read->fetchAll($select);
|
| 56 |
+
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
return array();
|
| 60 |
+
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
//save and load methods
|
| 68 |
+
|
| 69 |
+
public function save() {
|
| 70 |
+
|
| 71 |
+
$resource = Mage::getSingleton('core/resource');
|
| 72 |
+
|
| 73 |
+
$connection= $resource->getConnection('ticketsystem_write');
|
| 74 |
+
|
| 75 |
+
$connection->beginTransaction();
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
try {
|
| 80 |
+
|
| 81 |
+
$this->_beforeSave();
|
| 82 |
+
|
| 83 |
+
if ($this->getID()==0)
|
| 84 |
+
|
| 85 |
+
$this->setID(Mage::helper('ticketsystem')->getTicketID());
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
$query= 'insert into mticketing_tickets (ID, name, subject, orders, phone, timestamp, ip, cat, priority, email) VALUES('
|
| 90 |
+
|
| 91 |
+
."'".$this->getID()."',"
|
| 92 |
+
|
| 93 |
+
."'".$this->getName()."',"
|
| 94 |
+
|
| 95 |
+
."'".$this->getSubject()."',"
|
| 96 |
+
|
| 97 |
+
."'".$this->getOrders()."',"
|
| 98 |
+
|
| 99 |
+
."'".$this->getPhone()."',"
|
| 100 |
+
|
| 101 |
+
."'".$this->getTimestamp()."',"
|
| 102 |
+
|
| 103 |
+
."'".$this->getIp()."',"
|
| 104 |
+
|
| 105 |
+
."'".$this->getCat()."',"
|
| 106 |
+
|
| 107 |
+
."'".$this->getPriority()."',"
|
| 108 |
+
|
| 109 |
+
."'".$this->getEmail()."')";
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
$connection->query($query);
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
$connection->commit();
|
| 118 |
+
|
| 119 |
+
$this->_afterSave();
|
| 120 |
+
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
catch (Exception $e) {
|
| 124 |
+
|
| 125 |
+
Mage::log('Exception:'.$e);
|
| 126 |
+
|
| 127 |
+
$connection->rollBack();
|
| 128 |
+
|
| 129 |
+
throw $e;
|
| 130 |
+
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
return $this;
|
| 134 |
+
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
public function update() {
|
| 140 |
+
|
| 141 |
+
parent::save();
|
| 142 |
+
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
}
|
app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/CatController.php
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Adminhtml_CatController extends Mage_Adminhtml_Controller_action
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
protected function _initAction() {
|
| 27 |
+
$this->loadLayout()
|
| 28 |
+
->_setActiveMenu('ticketsystem/cat')
|
| 29 |
+
->_addBreadcrumb(Mage::helper('ticketsystem')->__('Departments'), Mage::helper('ticketsystem')->__('Departments'));
|
| 30 |
+
|
| 31 |
+
return $this;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
public function indexAction() {
|
| 35 |
+
$this->_initAction();
|
| 36 |
+
$this->renderLayout();
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
public function editAction() {
|
| 41 |
+
$this->loadLayout();
|
| 42 |
+
$this->_setActiveMenu('ticketsystem/cat');
|
| 43 |
+
$this->_addBreadcrumb(Mage::helper('ticketsystem')->__('Tickets'), Mage::helper('ticketsystem')->__('Departments'));
|
| 44 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
$id = $this->getRequest()->getParam('id');
|
| 48 |
+
// Edit Ticket
|
| 49 |
+
if ($id > 0) {
|
| 50 |
+
|
| 51 |
+
$model = Mage::getModel('ticketsystem/cats')->load($id);
|
| 52 |
+
// set data for the front.
|
| 53 |
+
Mage::register('cat_data', $model);
|
| 54 |
+
}
|
| 55 |
+
$this->_addContent($this->getLayout()->createBlock('ticketsystem/adminhtml_cat_edit'))
|
| 56 |
+
->_addLeft($this->getLayout()->createBlock('ticketsystem/adminhtml_cat_edit_tabs'));
|
| 57 |
+
$this->renderLayout();
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
public function newAction() {
|
| 62 |
+
$this->_forward('edit');
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
public function saveAction() {
|
| 66 |
+
$id=$this->getRequest()->getParam('id');
|
| 67 |
+
$data = $this->getRequest()->getPost();
|
| 68 |
+
|
| 69 |
+
$is_new=false;
|
| 70 |
+
if ($id == 0)
|
| 71 |
+
$is_new=true;
|
| 72 |
+
try {
|
| 73 |
+
// *********************************************
|
| 74 |
+
// New Cat
|
| 75 |
+
if ($is_new){
|
| 76 |
+
$cat= Mage::getModel('ticketsystem/cats');
|
| 77 |
+
$cat->setData($data);
|
| 78 |
+
$cat->save();
|
| 79 |
+
}
|
| 80 |
+
// Existing Cat
|
| 81 |
+
else{
|
| 82 |
+
$cat=Mage::getModel('ticketsystem/cats')->load($id);
|
| 83 |
+
$cat->setData($data);
|
| 84 |
+
$cat->setData('ID',$id);
|
| 85 |
+
$cat->save();
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
// *********************************************
|
| 89 |
+
|
| 90 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Department was successfully saved'));
|
| 91 |
+
|
| 92 |
+
if ($is_new)
|
| 93 |
+
$this->_redirect('*/*/', array('id' => $id));
|
| 94 |
+
else
|
| 95 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
| 96 |
+
|
| 97 |
+
} catch (Exception $e) {
|
| 98 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 99 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 100 |
+
$this->_redirect('*/*/', array('id' => $id));
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
public function deleteAction() {
|
| 106 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
| 107 |
+
try {
|
| 108 |
+
$model = Mage::getModel('ticketsystem/cats');
|
| 109 |
+
|
| 110 |
+
$model->setId($this->getRequest()->getParam('id'))
|
| 111 |
+
->delete();
|
| 112 |
+
|
| 113 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Department was successfully deleted'));
|
| 114 |
+
$this->_redirect('*/*/');
|
| 115 |
+
} catch (Exception $e) {
|
| 116 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 117 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
$this->_redirect('*/*/');
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
public function massDeleteAction() {
|
| 124 |
+
$ticketsystemIds = $this->getRequest()->getParam('ticketsystem');
|
| 125 |
+
if(!is_array($ticketsystemIds)) {
|
| 126 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please select department(s)'));
|
| 127 |
+
} else {
|
| 128 |
+
try {
|
| 129 |
+
foreach ($ticketsystemIds as $ticketsystemId) {
|
| 130 |
+
$ticketsystem = Mage::getModel('ticketsystem/cats')->load($ticketsystemId);
|
| 131 |
+
$ticketsystem->delete();
|
| 132 |
+
}
|
| 133 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 134 |
+
Mage::helper('ticketsystem')->__(
|
| 135 |
+
'Total of %d record(s) were successfully deleted', count($ticketsystemIds)
|
| 136 |
+
)
|
| 137 |
+
);
|
| 138 |
+
} catch (Exception $e) {
|
| 139 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
$this->_redirect('*/*/index');
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
public function exportCsvAction()
|
| 148 |
+
{
|
| 149 |
+
$fileName = 'ticketsystem.csv';
|
| 150 |
+
$content = $this->getLayout()->createBlock('ticketsystem/adminhtml_softicket_grid')
|
| 151 |
+
->getCsv();
|
| 152 |
+
|
| 153 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
public function exportXmlAction()
|
| 157 |
+
{
|
| 158 |
+
$fileName = 'ticketsystem.xml';
|
| 159 |
+
$content = $this->getLayout()->createBlock('ticketsystem/adminhtml_softicket_grid')
|
| 160 |
+
->getXml();
|
| 161 |
+
|
| 162 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
| 166 |
+
{
|
| 167 |
+
$response = $this->getResponse();
|
| 168 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
| 169 |
+
$response->setHeader('Pragma', 'public', true);
|
| 170 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 171 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
| 172 |
+
$response->setHeader('Last-Modified', date('r'));
|
| 173 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
| 174 |
+
$response->setHeader('Content-Length', strlen($content));
|
| 175 |
+
$response->setHeader('Content-type', $contentType);
|
| 176 |
+
$response->setBody($content);
|
| 177 |
+
$response->sendResponse();
|
| 178 |
+
die;
|
| 179 |
+
}
|
| 180 |
+
}
|
app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/MailController.php
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Adminhtml_MailController extends Mage_Adminhtml_Controller_action
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
protected function _initAction() {
|
| 27 |
+
$this->loadLayout()
|
| 28 |
+
->_setActiveMenu('ticketsystem/mail')
|
| 29 |
+
->_addBreadcrumb(Mage::helper('ticketsystem')->__('TicketSystem'), Mage::helper('ticketsystem')->__('Mail Responses'));
|
| 30 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 31 |
+
return $this;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
public function indexAction() {
|
| 35 |
+
$this->_forward('edit');
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
public function editAction() {
|
| 40 |
+
$this->loadLayout();
|
| 41 |
+
$this->_setActiveMenu('ticketsystem/mail');
|
| 42 |
+
$this->_addBreadcrumb(Mage::helper('ticketsystem')->__('TicketSystem'), Mage::helper('ticketsystem')->__('Mail Responses'));
|
| 43 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
$model = Mage::getModel('ticketsystem/mail');
|
| 47 |
+
|
| 48 |
+
if ($model){
|
| 49 |
+
$array = array();
|
| 50 |
+
foreach($model->getCollection()->load() as $_item) {
|
| 51 |
+
$key=$_item->getData('key');
|
| 52 |
+
$value=$_item->getData('value');
|
| 53 |
+
$array[$key]= $value;
|
| 54 |
+
}
|
| 55 |
+
$model->setData($array);
|
| 56 |
+
Mage::register('ticketsystem_maildata', $model);
|
| 57 |
+
|
| 58 |
+
$this->_addContent($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_mail'))
|
| 59 |
+
->_addLeft($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_mail_tabs'));
|
| 60 |
+
} else {
|
| 61 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Item does not exist'));
|
| 62 |
+
$this->_redirect('*/*/');
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
$this->renderLayout();
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
public function newAction() {
|
| 70 |
+
$this->_forward('edit');
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
public function saveAction() {
|
| 74 |
+
|
| 75 |
+
if ($data = $this->getRequest()->getPost()) {
|
| 76 |
+
$model = Mage::getModel('ticketsystem/mail');
|
| 77 |
+
try {
|
| 78 |
+
foreach($model->getCollection()->load() as $_item) {
|
| 79 |
+
$id=$_item->getData('ID');
|
| 80 |
+
$key=$_item->getData('key');
|
| 81 |
+
$array = null;
|
| 82 |
+
if(array_key_exists($key,$data)){
|
| 83 |
+
$value=1;
|
| 84 |
+
if (! (strstr($key,'_response') || strstr($key,'_new')))
|
| 85 |
+
$value=$data[$key];
|
| 86 |
+
$array = array('ID'=> $id, 'key'=> $key, 'value'=> $value);
|
| 87 |
+
}else if (strstr($key,'_response') ||strstr($key,'_new')) {
|
| 88 |
+
Mage::log('key:'.$key);
|
| 89 |
+
$array = array('ID'=> $id, 'key'=> $key, 'value'=>0);
|
| 90 |
+
}
|
| 91 |
+
if($array){
|
| 92 |
+
$model->setData($array);
|
| 93 |
+
$model->save();
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Mail Responses were successfully saved'));
|
| 98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 99 |
+
|
| 100 |
+
if ($this->getRequest()->getParam('back')) {
|
| 101 |
+
$this->_redirect('*/*/edit');
|
| 102 |
+
return;
|
| 103 |
+
}
|
| 104 |
+
$this->_redirect('*/*/');
|
| 105 |
+
return;
|
| 106 |
+
} catch (Exception $e) {
|
| 107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 109 |
+
$this->_redirect('*/*/edit');
|
| 110 |
+
return;
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Unable to find item to save'));
|
| 114 |
+
$this->_redirect('*/*/');
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
}
|
app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/SettingController.php
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 0.5 beta
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
class MageTracking_TicketSystem_Adminhtml_SettingController extends Mage_Adminhtml_Controller_action
|
| 24 |
+
{
|
| 25 |
+
|
| 26 |
+
protected function _initAction() {
|
| 27 |
+
$this->loadLayout()
|
| 28 |
+
->_setActiveMenu('ticketsystem/setting')
|
| 29 |
+
->_addBreadcrumb(Mage::helper('ticketsystem')->__('TicketSystem'), Mage::helper('ticketsystem')->__('Settings'));
|
| 30 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 31 |
+
return $this;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
public function indexAction() {
|
| 35 |
+
$this->_forward('edit');
|
| 36 |
+
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
public function editAction() {
|
| 40 |
+
$this->loadLayout();
|
| 41 |
+
$this->_setActiveMenu('ticketsystem/setting');
|
| 42 |
+
$this->_addBreadcrumb(Mage::helper('ticketsystem')->__('TicketSystem'), Mage::helper('ticketsystem')->__('Settings'));
|
| 43 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 44 |
+
|
| 45 |
+
$model = Mage::getModel('ticketsystem/settings');
|
| 46 |
+
|
| 47 |
+
if ($model){
|
| 48 |
+
$array = array();
|
| 49 |
+
foreach($model->getCollection()->load() as $_item) {
|
| 50 |
+
$key=$_item->getData('key');
|
| 51 |
+
$value=$_item->getData('value');
|
| 52 |
+
$array[$key]= $value;
|
| 53 |
+
}
|
| 54 |
+
$model->setData($array);
|
| 55 |
+
Mage::register('ticketsystem_settingdata', $model);
|
| 56 |
+
|
| 57 |
+
$this->_addContent($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_setting'))
|
| 58 |
+
->_addLeft($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_setting_tabs'));
|
| 59 |
+
|
| 60 |
+
$this->renderLayout();
|
| 61 |
+
} else {
|
| 62 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Item does not exist'));
|
| 63 |
+
$this->_redirect('*/*/');
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
public function newAction() {
|
| 71 |
+
$this->_forward('edit');
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
public function saveAction() {
|
| 75 |
+
|
| 76 |
+
if ($data = $this->getRequest()->getPost()) {
|
| 77 |
+
|
| 78 |
+
$model = Mage::getModel('ticketsystem/settings');
|
| 79 |
+
|
| 80 |
+
try {
|
| 81 |
+
foreach($model->getCollection()->load() as $_item) {
|
| 82 |
+
$id=$_item->getData('ID');
|
| 83 |
+
$key=$_item->getData('key');
|
| 84 |
+
$array= null;
|
| 85 |
+
if(array_key_exists($key,$data)){
|
| 86 |
+
$value=1;
|
| 87 |
+
if (! (strstr($key,'smtp_auth') || strstr($key,'alert_new')))
|
| 88 |
+
$value=$data[$key];
|
| 89 |
+
$array = array('ID'=> $id, 'key'=> $key, 'value'=> $value);
|
| 90 |
+
}
|
| 91 |
+
else if (strstr($key,'smtp_auth') ||strstr($key,'alert_new')) {
|
| 92 |
+
$array = array('ID'=> $id, 'key'=> $key, 'value'=>0);
|
| 93 |
+
}
|
| 94 |
+
if($array){
|
| 95 |
+
$model->setData($array);
|
| 96 |
+
$model->save();
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Settings were successfully updated'));
|
| 101 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 102 |
+
|
| 103 |
+
if ($this->getRequest()->getParam('back')) {
|
| 104 |
+
$this->_redirect('*/*/edit');
|
| 105 |
+
return;
|
| 106 |
+
}
|
| 107 |
+
$this->_redirect('*/*/');
|
| 108 |
+
return;
|
| 109 |
+
} catch (Exception $e) {
|
| 110 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 111 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 112 |
+
$this->_redirect('*/*/edit');
|
| 113 |
+
return;
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Unable to find item to save'));
|
| 117 |
+
$this->_redirect('*/*/');
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
}
|
app/code/community/MageTracking/TicketSystem/controllers/Adminhtml/TicketsystemController.php
ADDED
|
@@ -0,0 +1,676 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
| 8 |
+
|
| 9 |
+
* NOTICE OF LICENSE
|
| 10 |
+
|
| 11 |
+
*
|
| 12 |
+
|
| 13 |
+
* This source file is subject to the GNU (3.0)
|
| 14 |
+
|
| 15 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 16 |
+
|
| 17 |
+
* It is also available through the world-wide-web at this URL:
|
| 18 |
+
|
| 19 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 20 |
+
|
| 21 |
+
* If you did not receive a copy of the license and are unable to
|
| 22 |
+
|
| 23 |
+
* obtain it through the world-wide-web, please send an email
|
| 24 |
+
|
| 25 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 26 |
+
|
| 27 |
+
*
|
| 28 |
+
|
| 29 |
+
* @category design_default
|
| 30 |
+
|
| 31 |
+
* @author sofhere.com
|
| 32 |
+
|
| 33 |
+
* @package Sofhere_SofTicket
|
| 34 |
+
|
| 35 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 36 |
+
|
| 37 |
+
* @version 0.5 beta
|
| 38 |
+
|
| 39 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 40 |
+
|
| 41 |
+
*/
|
| 42 |
+
|
| 43 |
+
require 'MageTracking/TicketSystem/Helper/Ticket.php';
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class MageTracking_TicketSystem_Adminhtml_TicketsystemController extends Mage_Adminhtml_Controller_action
|
| 48 |
+
|
| 49 |
+
{
|
| 50 |
+
|
| 51 |
+
protected function _initAction() {
|
| 52 |
+
|
| 53 |
+
$this->loadLayout()
|
| 54 |
+
|
| 55 |
+
->_setActiveMenu('ticketsystem/ticket')
|
| 56 |
+
|
| 57 |
+
->_addBreadcrumb(Mage::helper('ticketsystem')->__('TicketSystem'), Mage::helper('ticketsystem')->__('View Tickets'));
|
| 58 |
+
|
| 59 |
+
return $this;
|
| 60 |
+
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
public function indexAction() {
|
| 66 |
+
|
| 67 |
+
$this->_initAction();
|
| 68 |
+
|
| 69 |
+
$this->renderLayout();
|
| 70 |
+
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
public function editAction() {
|
| 78 |
+
|
| 79 |
+
$this->loadLayout();
|
| 80 |
+
|
| 81 |
+
$this->_setActiveMenu('ticketsystem/items');
|
| 82 |
+
|
| 83 |
+
$this->_addBreadcrumb(Mage::helper('ticketsystem')->__('Ticket'), Mage::helper('ticketsystem')->__('View Tickets'));
|
| 84 |
+
|
| 85 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
$cats = Mage::helper('ticketsystem')->getAllCategories(true);
|
| 90 |
+
|
| 91 |
+
//$reps=Mage::helper('ticketsystem')->getAllRepresantatives();
|
| 92 |
+
|
| 93 |
+
//Mage::register('ticketsystem_represantatives',$reps);
|
| 94 |
+
|
| 95 |
+
Mage::register('ticketsystem_categories', $cats);
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
$id = $this->getRequest()->getParam('id');
|
| 100 |
+
|
| 101 |
+
// Edit Ticket
|
| 102 |
+
|
| 103 |
+
if ($id > 0) {
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
// **********************************************
|
| 108 |
+
|
| 109 |
+
$model = Mage::getModel('ticketsystem/ticketsystem')->load($id);
|
| 110 |
+
|
| 111 |
+
$model->setData('hidden_ID',$id);
|
| 112 |
+
|
| 113 |
+
$model->setData('hidden_status',$model->getData('status'));
|
| 114 |
+
|
| 115 |
+
$model->setData('hidden_subject',$model->getData('subject'));
|
| 116 |
+
|
| 117 |
+
$model->setData('hidden_name',$model->getData('name'));
|
| 118 |
+
|
| 119 |
+
$model->setData('hidden_email',$model->getData('email'));
|
| 120 |
+
|
| 121 |
+
$model->setData('hidden_phone',$model->getData('phone'));
|
| 122 |
+
|
| 123 |
+
$model->setData('hidden_order',$model->getData('order'));
|
| 124 |
+
|
| 125 |
+
$model->setData('cat_alert',1);
|
| 126 |
+
|
| 127 |
+
$model->setData('rep_alert',1);
|
| 128 |
+
|
| 129 |
+
// **********************************************
|
| 130 |
+
|
| 131 |
+
Mage::register('ticketsystem_data', $model);
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
$answers='';
|
| 136 |
+
|
| 137 |
+
$model_ans = Mage::getModel('ticketsystem/answers');
|
| 138 |
+
|
| 139 |
+
foreach ($model_ans->getCollection()->addFieldToFilter('ticket',$id)->load() as $item){
|
| 140 |
+
|
| 141 |
+
$message=$item->getData('message');
|
| 142 |
+
|
| 143 |
+
$rep=$item->getData('rep');
|
| 144 |
+
|
| 145 |
+
$timestamp=$item->getData('timestamp');
|
| 146 |
+
|
| 147 |
+
$answers .='('.$timestamp.') '.$message."\n";
|
| 148 |
+
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
$model_msg = Mage::getModel('ticketsystem/messages')->load($id, 'ticket');
|
| 152 |
+
|
| 153 |
+
$message = $model_msg->getMessage();
|
| 154 |
+
|
| 155 |
+
$timestamp= $model_msg->getTimestamp();
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
$message ='('.$timestamp.') '.$message."\n";
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
if ($answers)
|
| 163 |
+
|
| 164 |
+
$message = $message."\n".$answers;
|
| 165 |
+
|
| 166 |
+
// **********************************************
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
// Set message to front
|
| 171 |
+
|
| 172 |
+
$model->setData('message', $message);
|
| 173 |
+
|
| 174 |
+
$model->setData('trans_note', $model->getData('trans_msg'));
|
| 175 |
+
|
| 176 |
+
$model->setData('trans_msg','');
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
$this->_addContent($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_edit'))
|
| 181 |
+
|
| 182 |
+
->_addLeft($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_edit_tabs'));
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
} else {
|
| 187 |
+
|
| 188 |
+
// New Ticket
|
| 189 |
+
|
| 190 |
+
$this->_addContent($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_edit'))
|
| 191 |
+
|
| 192 |
+
->_addLeft($this->getLayout()->createBlock('ticketsystem/adminhtml_ticketsystem_edit_newtabs'));
|
| 193 |
+
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
$this->renderLayout();
|
| 197 |
+
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
public function onholdAction() {
|
| 205 |
+
|
| 206 |
+
$ticket = new Ticket();
|
| 207 |
+
|
| 208 |
+
$ticket->id = $this->getRequest()->getParam('id');
|
| 209 |
+
|
| 210 |
+
$ticket->changeStatus('onhold');
|
| 211 |
+
|
| 212 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Status was successfully changed'));
|
| 213 |
+
|
| 214 |
+
$this->_redirect('*/*/');
|
| 215 |
+
|
| 216 |
+
return;
|
| 217 |
+
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
public function setstatAction() {
|
| 225 |
+
|
| 226 |
+
$ticket = new Ticket();
|
| 227 |
+
|
| 228 |
+
$id = $this->getRequest()->getParam('id');
|
| 229 |
+
|
| 230 |
+
$new_status = $this->getRequest()->getParam('new_status');
|
| 231 |
+
|
| 232 |
+
if($new_status){
|
| 233 |
+
|
| 234 |
+
$ticket->changeStatus($id,$new_status);
|
| 235 |
+
|
| 236 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Status was successfully changed'));
|
| 237 |
+
|
| 238 |
+
}else{
|
| 239 |
+
|
| 240 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please select a status'));
|
| 241 |
+
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
| 245 |
+
|
| 246 |
+
return;
|
| 247 |
+
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
public function transrepAction() {
|
| 255 |
+
|
| 256 |
+
$id = $this->getRequest()->getParam('id');
|
| 257 |
+
|
| 258 |
+
$repId = $this->getRequest()->getParam('reps');
|
| 259 |
+
|
| 260 |
+
$alert = $this->getRequest()->getParam('rep_alert');
|
| 261 |
+
|
| 262 |
+
if($repId){
|
| 263 |
+
|
| 264 |
+
$ticket = new Ticket();
|
| 265 |
+
|
| 266 |
+
$ticket->transRepTicket($id, $repId, $alert);
|
| 267 |
+
|
| 268 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Represantative was successfully assigned'));
|
| 269 |
+
|
| 270 |
+
}else{
|
| 271 |
+
|
| 272 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please select a represantative'));
|
| 273 |
+
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
| 277 |
+
|
| 278 |
+
return;
|
| 279 |
+
|
| 280 |
+
}
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
|
| 286 |
+
public function transcatAction() {
|
| 287 |
+
|
| 288 |
+
$id = $this->getRequest()->getParam('id');
|
| 289 |
+
|
| 290 |
+
$catId = $this->getRequest()->getParam('cats');
|
| 291 |
+
|
| 292 |
+
$cat_message = $this->getRequest()->getParam('message');
|
| 293 |
+
|
| 294 |
+
$alert = $this->getRequest()->getParam('cat_alert');
|
| 295 |
+
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
$ticket = new Ticket();
|
| 299 |
+
|
| 300 |
+
$ticket->transCatTicket($id, $catId, $cat_message, $alert);
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Ticket is transfered to department successfully'));
|
| 305 |
+
|
| 306 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 307 |
+
|
| 308 |
+
return;
|
| 309 |
+
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
public function newAction() {
|
| 315 |
+
|
| 316 |
+
$this->_forward('edit');
|
| 317 |
+
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
public function saveAction() {
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
$id=$this->getRequest()->getParam('id');
|
| 327 |
+
|
| 328 |
+
$data = $this->getRequest()->getPost();
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
$is_new=false;
|
| 333 |
+
|
| 334 |
+
if ($id == 0)
|
| 335 |
+
|
| 336 |
+
$is_new=true;
|
| 337 |
+
|
| 338 |
+
try {
|
| 339 |
+
|
| 340 |
+
// *********************************************
|
| 341 |
+
|
| 342 |
+
// New Ticket
|
| 343 |
+
|
| 344 |
+
if ($is_new){
|
| 345 |
+
|
| 346 |
+
if (empty($data['name'])==false && empty($data['email'])==false && empty($data['subject'])==false && empty($data['message'])==false)
|
| 347 |
+
|
| 348 |
+
$id=Mage::helper('ticketsystem')->getTicketID();
|
| 349 |
+
|
| 350 |
+
else {
|
| 351 |
+
|
| 352 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please enter all required fields'));
|
| 353 |
+
|
| 354 |
+
$this->_redirect('*/*/new', array('id' => $this->getRequest()->getParam('id')));
|
| 355 |
+
|
| 356 |
+
return;
|
| 357 |
+
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
// Existing Ticket
|
| 363 |
+
|
| 364 |
+
else if(is_array($data) && empty($data['answer'])){
|
| 365 |
+
|
| 366 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please enter the new message'));
|
| 367 |
+
|
| 368 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 369 |
+
|
| 370 |
+
return;
|
| 371 |
+
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
// *********************************************
|
| 377 |
+
|
| 378 |
+
$ticket = new Ticket();
|
| 379 |
+
|
| 380 |
+
$ticket->id=$id;
|
| 381 |
+
|
| 382 |
+
$ticket->message=$data['message'];
|
| 383 |
+
|
| 384 |
+
$ticket->timestamp=now();
|
| 385 |
+
|
| 386 |
+
if ($is_new){
|
| 387 |
+
|
| 388 |
+
$ticket->subject=$data['subject'];
|
| 389 |
+
|
| 390 |
+
$ticket->name=$data['name'];
|
| 391 |
+
|
| 392 |
+
$ticket->email=$data['email'];
|
| 393 |
+
|
| 394 |
+
$ticket->priority=$data['priority'];
|
| 395 |
+
|
| 396 |
+
$ticket->category=$data['cat'];
|
| 397 |
+
|
| 398 |
+
$ticket->ip=$_SERVER['REMOTE_ADDR'];
|
| 399 |
+
|
| 400 |
+
$ticket->phone=$data['phone'];
|
| 401 |
+
|
| 402 |
+
$ticket->orders=$data['orders'];
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
if(!$ticket->create(true)){
|
| 407 |
+
|
| 408 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Ticket could not be saved. Check all fields.'));
|
| 409 |
+
|
| 410 |
+
return;
|
| 411 |
+
|
| 412 |
+
}else{
|
| 413 |
+
|
| 414 |
+
// Do not notify user for the message post
|
| 415 |
+
|
| 416 |
+
$ticket->postMessage($id, $ticket->message, '', false, 'new');
|
| 417 |
+
|
| 418 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Ticket was successfully saved'));
|
| 419 |
+
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
}else if (is_array($data) && empty($data['answer'])==false && empty($data['priority'])==false && empty($data['cat'])==false) {
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
$answer=$data['answer'];
|
| 427 |
+
|
| 428 |
+
if (!empty($answer)) {
|
| 429 |
+
|
| 430 |
+
$user = Mage::getSingleton('admin/session')->getData('user');
|
| 431 |
+
|
| 432 |
+
$username= $user->getData('username');
|
| 433 |
+
|
| 434 |
+
if ($username){
|
| 435 |
+
|
| 436 |
+
$ticket->postAnswer($answer, '', '', $ticket->id, 'awaitingcustomer');
|
| 437 |
+
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Ticket was successfully saved'));
|
| 443 |
+
|
| 444 |
+
}else{
|
| 445 |
+
|
| 446 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Ticket could not be saved. Check all fields.'));
|
| 447 |
+
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
// *********************************************
|
| 451 |
+
|
| 452 |
+
|
| 453 |
+
|
| 454 |
+
if ($is_new)
|
| 455 |
+
|
| 456 |
+
$this->_redirect('*/*/', array('id' => $id));
|
| 457 |
+
|
| 458 |
+
else
|
| 459 |
+
|
| 460 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
| 461 |
+
|
| 462 |
+
|
| 463 |
+
|
| 464 |
+
} catch (Exception $e) {
|
| 465 |
+
|
| 466 |
+
//Mage::log('Save exception:'.$e);
|
| 467 |
+
|
| 468 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 469 |
+
|
| 470 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 471 |
+
|
| 472 |
+
$this->_redirect('*/*/', array('id' => $id));
|
| 473 |
+
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
|
| 480 |
+
public function deleteAction() {
|
| 481 |
+
|
| 482 |
+
$id=$this->getRequest()->getParam('id');
|
| 483 |
+
|
| 484 |
+
if( $id > 0 ) {
|
| 485 |
+
|
| 486 |
+
try {
|
| 487 |
+
|
| 488 |
+
$ticket = new Ticket();
|
| 489 |
+
|
| 490 |
+
$ticket->delete($id);
|
| 491 |
+
|
| 492 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('ticketsystem')->__('Ticket was successfully deleted'));
|
| 493 |
+
|
| 494 |
+
$this->_redirect('*/*/');
|
| 495 |
+
|
| 496 |
+
} catch (Exception $e) {
|
| 497 |
+
|
| 498 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 499 |
+
|
| 500 |
+
$this->_redirect('*/*/edit', array('id' => $id));
|
| 501 |
+
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
$this->_redirect('*/*/');
|
| 507 |
+
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
public function massDeleteAction() {
|
| 513 |
+
|
| 514 |
+
$softicketIds = $this->getRequest()->getParam('ticketsystem');
|
| 515 |
+
|
| 516 |
+
if(!is_array($softicketIds)) {
|
| 517 |
+
|
| 518 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please select ticket(s)'));
|
| 519 |
+
|
| 520 |
+
} else {
|
| 521 |
+
|
| 522 |
+
try {
|
| 523 |
+
|
| 524 |
+
foreach ($softicketIds as $softicketId) {
|
| 525 |
+
|
| 526 |
+
$ticket = new Ticket();
|
| 527 |
+
|
| 528 |
+
$ticket->delete($softicketId);
|
| 529 |
+
|
| 530 |
+
}
|
| 531 |
+
|
| 532 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 533 |
+
|
| 534 |
+
Mage::helper('ticketsystem')->__('Total of %d record(s) were successfully deleted', count($softicketIds)));
|
| 535 |
+
|
| 536 |
+
} catch (Exception $e) {
|
| 537 |
+
|
| 538 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 539 |
+
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
$this->_redirect('*/*/index');
|
| 545 |
+
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
|
| 550 |
+
public function massStatusAction()
|
| 551 |
+
|
| 552 |
+
{
|
| 553 |
+
|
| 554 |
+
$softicketIds = $this->getRequest()->getParam('ticketsystem');
|
| 555 |
+
|
| 556 |
+
$status = $this->getRequest()->getParam('status');
|
| 557 |
+
|
| 558 |
+
if(!is_array($softicketIds)) {
|
| 559 |
+
|
| 560 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please select ticket(s)'));
|
| 561 |
+
|
| 562 |
+
} else {
|
| 563 |
+
|
| 564 |
+
try {
|
| 565 |
+
|
| 566 |
+
foreach ($softicketIds as $softicketId) {
|
| 567 |
+
|
| 568 |
+
if ($softicketId >0){
|
| 569 |
+
|
| 570 |
+
$ticket = new Ticket();
|
| 571 |
+
|
| 572 |
+
$ticket->changeStatus($softicketId, $status);
|
| 573 |
+
|
| 574 |
+
}else{
|
| 575 |
+
|
| 576 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('ticketsystem')->__('Please select ticket(s)'));
|
| 577 |
+
|
| 578 |
+
$this->_redirect('*/*/index');
|
| 579 |
+
|
| 580 |
+
return;
|
| 581 |
+
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
$this->_getSession()->addSuccess(Mage::helper('ticketsystem')->__('Total of %d record(s) were successfully updated', count($softicketIds)));
|
| 587 |
+
|
| 588 |
+
} catch (Exception $e) {
|
| 589 |
+
|
| 590 |
+
$this->_getSession()->addError($e->getMessage());
|
| 591 |
+
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
$this->_redirect('*/*/index');
|
| 597 |
+
|
| 598 |
+
}
|
| 599 |
+
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
public function exportCsvAction()
|
| 603 |
+
|
| 604 |
+
{
|
| 605 |
+
|
| 606 |
+
$fileName = 'ticketsystem.csv';
|
| 607 |
+
|
| 608 |
+
$content = $this->getLayout()->createBlock('ticketsystem/adminhtml_softicket_grid')
|
| 609 |
+
|
| 610 |
+
->getCsv();
|
| 611 |
+
|
| 612 |
+
|
| 613 |
+
|
| 614 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 615 |
+
|
| 616 |
+
}
|
| 617 |
+
|
| 618 |
+
|
| 619 |
+
|
| 620 |
+
public function exportXmlAction()
|
| 621 |
+
|
| 622 |
+
{
|
| 623 |
+
|
| 624 |
+
$fileName = 'ticketsystem.xml';
|
| 625 |
+
|
| 626 |
+
$content = $this->getLayout()->createBlock('ticketsystem/adminhtml_softicket_grid')
|
| 627 |
+
|
| 628 |
+
->getXml();
|
| 629 |
+
|
| 630 |
+
|
| 631 |
+
|
| 632 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 633 |
+
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
|
| 637 |
+
|
| 638 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
| 639 |
+
|
| 640 |
+
{
|
| 641 |
+
|
| 642 |
+
$response = $this->getResponse();
|
| 643 |
+
|
| 644 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
| 645 |
+
|
| 646 |
+
$response->setHeader('Pragma', 'public', true);
|
| 647 |
+
|
| 648 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 649 |
+
|
| 650 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
| 651 |
+
|
| 652 |
+
$response->setHeader('Last-Modified', date('r'));
|
| 653 |
+
|
| 654 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
| 655 |
+
|
| 656 |
+
$response->setHeader('Content-Length', strlen($content));
|
| 657 |
+
|
| 658 |
+
$response->setHeader('Content-type', $contentType);
|
| 659 |
+
|
| 660 |
+
$response->setBody($content);
|
| 661 |
+
|
| 662 |
+
$response->sendResponse();
|
| 663 |
+
|
| 664 |
+
die;
|
| 665 |
+
|
| 666 |
+
}
|
| 667 |
+
|
| 668 |
+
|
| 669 |
+
|
| 670 |
+
|
| 671 |
+
|
| 672 |
+
|
| 673 |
+
|
| 674 |
+
|
| 675 |
+
|
| 676 |
+
}
|
app/code/community/MageTracking/TicketSystem/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
|
| 5 |
+
* Sofhere SofTicket Magento Component
|
| 6 |
+
|
| 7 |
+
*
|
| 8 |
+
|
| 9 |
+
* NOTICE OF LICENSE
|
| 10 |
+
|
| 11 |
+
*
|
| 12 |
+
|
| 13 |
+
* This source file is subject to the GNU (3.0)
|
| 14 |
+
|
| 15 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 16 |
+
|
| 17 |
+
* It is also available through the world-wide-web at this URL:
|
| 18 |
+
|
| 19 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 20 |
+
|
| 21 |
+
* If you did not receive a copy of the license and are unable to
|
| 22 |
+
|
| 23 |
+
* obtain it through the world-wide-web, please send an email
|
| 24 |
+
|
| 25 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 26 |
+
|
| 27 |
+
*
|
| 28 |
+
|
| 29 |
+
* @category design_default
|
| 30 |
+
|
| 31 |
+
* @author sofhere.com
|
| 32 |
+
|
| 33 |
+
* @package Sofhere_SofTicket
|
| 34 |
+
|
| 35 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 36 |
+
|
| 37 |
+
* @version 0.5 beta
|
| 38 |
+
|
| 39 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 40 |
+
|
| 41 |
+
*/
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
require 'MageTracking/TicketSystem/Helper/Ticket.php';
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class MageTracking_TicketSystem_IndexController extends Mage_Core_Controller_Front_Action
|
| 50 |
+
|
| 51 |
+
{
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
protected function _getSession()
|
| 56 |
+
|
| 57 |
+
{
|
| 58 |
+
|
| 59 |
+
return Mage::getSingleton('customer/session');
|
| 60 |
+
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
public function preDispatch()
|
| 66 |
+
|
| 67 |
+
{
|
| 68 |
+
|
| 69 |
+
parent::preDispatch();
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 74 |
+
|
| 75 |
+
if (! $this->_getSession()->authenticate($this)) {
|
| 76 |
+
|
| 77 |
+
$this->setFlag('', 'no-dispatch', true);
|
| 78 |
+
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
public function indexAction()
|
| 88 |
+
|
| 89 |
+
{
|
| 90 |
+
|
| 91 |
+
$ticketsystemModel = Mage::getModel('ticketsystem/ticketsystem');
|
| 92 |
+
|
| 93 |
+
$customerId= $this->_getSession()->getCustomerId();
|
| 94 |
+
|
| 95 |
+
$ticketsystem= $ticketsystemModel->getAllTickets($customerId);
|
| 96 |
+
|
| 97 |
+
Mage::register('ticketsystem_all', $ticketsystem, true);
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
if ((is_null($ticketsystem) == false) && (empty($ticketsystem) == false) ) {
|
| 102 |
+
|
| 103 |
+
$this->loadLayout();
|
| 104 |
+
|
| 105 |
+
$this->_initLayoutMessages('customer/session');
|
| 106 |
+
|
| 107 |
+
$this->renderLayout();
|
| 108 |
+
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
else {
|
| 112 |
+
|
| 113 |
+
$this->getResponse()->setRedirect(Mage::getUrl('*/*/add'));
|
| 114 |
+
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
public function addAction()
|
| 122 |
+
|
| 123 |
+
{
|
| 124 |
+
|
| 125 |
+
$this->loadLayout();
|
| 126 |
+
|
| 127 |
+
$this->_initLayoutMessages('customer/session');
|
| 128 |
+
if ($navigationBlock = $this->getLayout()->getBlock('customer_account_navigation')) {
|
| 129 |
+
|
| 130 |
+
$navigationBlock->setActive('ticketsystem');
|
| 131 |
+
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
$this->renderLayout();
|
| 135 |
+
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
public function editAction()
|
| 141 |
+
|
| 142 |
+
{
|
| 143 |
+
|
| 144 |
+
$this->loadLayout();
|
| 145 |
+
|
| 146 |
+
$this->_initLayoutMessages('customer/session');
|
| 147 |
+
|
| 148 |
+
if ($navigationBlock = $this->getLayout()->getBlock('customer_account_navigation')) {
|
| 149 |
+
|
| 150 |
+
$navigationBlock->setActive('ticketsystem');
|
| 151 |
+
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
$this->renderLayout();
|
| 157 |
+
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
public function editPostAction()
|
| 163 |
+
|
| 164 |
+
{
|
| 165 |
+
|
| 166 |
+
$data= $this->getRequest()->getPost();
|
| 167 |
+
|
| 168 |
+
//print_r($data);die();
|
| 169 |
+
|
| 170 |
+
if ($data && $data['ID'] && $data['ID'] >0 ) {
|
| 171 |
+
|
| 172 |
+
try {
|
| 173 |
+
|
| 174 |
+
//$repid=$data['rep'];
|
| 175 |
+
|
| 176 |
+
$id=$data['ID'];
|
| 177 |
+
|
| 178 |
+
$answer=$data['answer'];
|
| 179 |
+
|
| 180 |
+
$rep_name='';
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
$ticket = new Ticket();
|
| 187 |
+
|
| 188 |
+
$ticket->postAnswer($answer, '','', $id, 'custreplied');
|
| 189 |
+
|
| 190 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 191 |
+
|
| 192 |
+
$this->_getSession()->addSuccess($this->__('Ticket was successfully updated'));
|
| 193 |
+
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
else
|
| 197 |
+
|
| 198 |
+
{
|
| 199 |
+
|
| 200 |
+
Mage::getSingleton('core/session')->addSuccess($this->__('Ticket was successfully updated'));
|
| 201 |
+
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
$this->_redirectSuccess(Mage::getUrl('*/*/', array('_secure'=>true, 'id'=>$id)));
|
| 205 |
+
|
| 206 |
+
return;
|
| 207 |
+
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
catch (Mage_Core_Exception $e) {
|
| 211 |
+
|
| 212 |
+
$this->_getSession()->setticketsystemFormData($this->getRequest()->getPost())
|
| 213 |
+
|
| 214 |
+
->addException($e, $e->getMessage());
|
| 215 |
+
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
catch (Exception $e) {
|
| 219 |
+
|
| 220 |
+
$this->_getSession()->setticketsystemFormData($this->getRequest()->getPost())
|
| 221 |
+
|
| 222 |
+
->addException($e, $this->__('Ticket cannot be saved'));
|
| 223 |
+
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 229 |
+
|
| 230 |
+
$this->_getSession()->addError($this->__('Ticket cannot be saved'));
|
| 231 |
+
|
| 232 |
+
} else {
|
| 233 |
+
|
| 234 |
+
Mage::getSingleton('core/session')->addError($this->__('Ticket cannot be saved'));
|
| 235 |
+
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
$this->_redirectError(Mage::getUrl('*/*/'));
|
| 239 |
+
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
public function addPostAction()
|
| 247 |
+
|
| 248 |
+
{
|
| 249 |
+
|
| 250 |
+
$data= $this->getRequest()->getPost();
|
| 251 |
+
//print_r($data);die();
|
| 252 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 253 |
+
//$select = "SELECT * from ticket_tickets where status NOT LIKE 'CLOSED' AND email = '".$data['email']."' ";
|
| 254 |
+
$select = "SELECT * from mticketing_tickets where status NOT LIKE 'CLOSED' AND email = '".$data['email']."' ";
|
| 255 |
+
$rowArray = $connection->fetchAll($select); //return row
|
| 256 |
+
$ticket_id = $rowArray[0]['ID'];
|
| 257 |
+
$ticket_count = count($rowArray);
|
| 258 |
+
//print_r($data['email']);die();
|
| 259 |
+
//if ($data && $ticket_count==0) {
|
| 260 |
+
|
| 261 |
+
try {
|
| 262 |
+
|
| 263 |
+
$ticket = new Ticket();
|
| 264 |
+
//echo "look";die();
|
| 265 |
+
$id=Mage::helper('ticketsystem')->getTicketID();
|
| 266 |
+
|
| 267 |
+
$ticket->id=$id;
|
| 268 |
+
|
| 269 |
+
$ticket->message=$data['message'];
|
| 270 |
+
|
| 271 |
+
$ticket->timestamp=now();
|
| 272 |
+
|
| 273 |
+
$ticket->subject=$data['subject'];
|
| 274 |
+
|
| 275 |
+
$ticket->name=$data['name'];
|
| 276 |
+
|
| 277 |
+
$ticket->email=$data['email'];
|
| 278 |
+
|
| 279 |
+
$ticket->priority=$data['priority'];
|
| 280 |
+
|
| 281 |
+
$ticket->category=$data['cat'];
|
| 282 |
+
|
| 283 |
+
$ticket->ip=$_SERVER['REMOTE_ADDR'];
|
| 284 |
+
|
| 285 |
+
$ticket->phone=$data['phone'];
|
| 286 |
+
if ($data['orders']=='Select Order') {
|
| 287 |
+
$ticket->orders= '';
|
| 288 |
+
} else {
|
| 289 |
+
$ticket->orders=$data['orders'];
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
if(!$ticket->create(true)){
|
| 293 |
+
|
| 294 |
+
$this->_getSession()->addError($this->__('Ticket cannot be saved'));
|
| 295 |
+
|
| 296 |
+
$this->_redirectError(Mage::getUrl('*/*/'));
|
| 297 |
+
|
| 298 |
+
return;
|
| 299 |
+
|
| 300 |
+
}else{
|
| 301 |
+
|
| 302 |
+
$ticket->postMessage($id, $ticket->message, '', true, 'new');
|
| 303 |
+
|
| 304 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
| 305 |
+
|
| 306 |
+
$this->_getSession()->addSuccess($this->__('Ticket was successfully saved'));
|
| 307 |
+
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
else {
|
| 311 |
+
|
| 312 |
+
Mage::getSingleton('core/session')->addSuccess($this->__('Ticket was successfully saved'));
|
| 313 |
+
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
$this->_redirectSuccess(Mage::getUrl('*/*/', array('_secure'=>true)));
|
| 317 |
+
|
| 318 |
+
return;
|
| 319 |
+
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
catch (Mage_Core_Exception $e) {
|
| 325 |
+
|
| 326 |
+
$this->_getSession()->setticketsystemFormData($this->getRequest()->getPost())
|
| 327 |
+
|
| 328 |
+
->addException($e, $e->getMessage());
|
| 329 |
+
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
catch (Exception $e) {
|
| 333 |
+
|
| 334 |
+
$this->_getSession()->setticketsystemFormData($this->getRequest()->getPost())
|
| 335 |
+
|
| 336 |
+
->addException($e, $this->__('Ticket cannot be saved'));
|
| 337 |
+
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
// }
|
| 341 |
+
/*
|
| 342 |
+
else
|
| 343 |
+
{
|
| 344 |
+
// To get the refrence ID
|
| 345 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 346 |
+
$select_message_id = "SELECT id from ticket_messages where ticket = '".$ticket_id."'";
|
| 347 |
+
$rowArray_message = $connection->fetchRow($select_message_id); //return row
|
| 348 |
+
|
| 349 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 350 |
+
$connection->beginTransaction();
|
| 351 |
+
$fields = array();
|
| 352 |
+
$fields['ticket']= $ticket_id;
|
| 353 |
+
$fields['message']= $data['message'];
|
| 354 |
+
$fields['reference']= $rowArray_message['id'];
|
| 355 |
+
|
| 356 |
+
$connection->insert('ticket_answers', $fields);
|
| 357 |
+
$connection->commit();
|
| 358 |
+
|
| 359 |
+
Mage::getSingleton('core/session')->addSuccess('Ticket was successfully saved');
|
| 360 |
+
$this->_redirectSuccess(Mage::getUrl('*//*/index', array('_secure'=>true)));
|
| 361 |
+
return;
|
| 362 |
+
|
| 363 |
+
}*/
|
| 364 |
+
|
| 365 |
+
$this->_redirectError(Mage::getUrl('*/*/edit', array('id'=>$id)));
|
| 366 |
+
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<MageTracking_TicketSystem>
|
| 5 |
+
<version>1.2.1</version>
|
| 6 |
+
</MageTracking_TicketSystem>
|
| 7 |
+
</modules>
|
| 8 |
+
<frontend>
|
| 9 |
+
<routers>
|
| 10 |
+
<ticketsystem>
|
| 11 |
+
<use>standard</use>
|
| 12 |
+
<args>
|
| 13 |
+
<module>MageTracking_TicketSystem</module>
|
| 14 |
+
<frontName>ticketsystem</frontName>
|
| 15 |
+
</args>
|
| 16 |
+
</ticketsystem>
|
| 17 |
+
</routers>
|
| 18 |
+
<translate>
|
| 19 |
+
<modules>
|
| 20 |
+
<MageTracking_TicketSystem>
|
| 21 |
+
<files>
|
| 22 |
+
<default>MageTracking_TicketSystem.csv</default>
|
| 23 |
+
</files>
|
| 24 |
+
</MageTracking_TicketSystem>
|
| 25 |
+
</modules>
|
| 26 |
+
</translate>
|
| 27 |
+
<layout>
|
| 28 |
+
<updates>
|
| 29 |
+
<ticketsystem>
|
| 30 |
+
<file>ticketsystem.xml</file>
|
| 31 |
+
</ticketsystem>
|
| 32 |
+
</updates>
|
| 33 |
+
</layout>
|
| 34 |
+
</frontend>
|
| 35 |
+
<admin>
|
| 36 |
+
<routers>
|
| 37 |
+
<ticketsystem>
|
| 38 |
+
<use>admin</use>
|
| 39 |
+
<args>
|
| 40 |
+
<module>MageTracking_TicketSystem</module>
|
| 41 |
+
<frontName>ticketsystem</frontName>
|
| 42 |
+
</args>
|
| 43 |
+
</ticketsystem>
|
| 44 |
+
</routers>
|
| 45 |
+
</admin>
|
| 46 |
+
<adminhtml>
|
| 47 |
+
<menu>
|
| 48 |
+
<ticketsystem translate="title" module="ticketsystem">
|
| 49 |
+
<title>Ticketing System</title>
|
| 50 |
+
<sort_order>71</sort_order>
|
| 51 |
+
<children>
|
| 52 |
+
<ticket translate="title" module="ticketsystem">
|
| 53 |
+
<title>View Tickets</title>
|
| 54 |
+
<sort_order>0</sort_order>
|
| 55 |
+
<action>ticketsystem/adminhtml_ticketsystem</action>
|
| 56 |
+
</ticket>
|
| 57 |
+
<mail translate="title" module="ticketsystem">
|
| 58 |
+
<title>Mail Responses</title>
|
| 59 |
+
<sort_order>1</sort_order>
|
| 60 |
+
<action>ticketsystem/adminhtml_mail</action>
|
| 61 |
+
</mail>
|
| 62 |
+
<cat translate="title" module="ticketsystem">
|
| 63 |
+
<title>Departments</title>
|
| 64 |
+
<sort_order>2</sort_order>
|
| 65 |
+
<action>ticketsystem/adminhtml_cat</action>
|
| 66 |
+
</cat>
|
| 67 |
+
<setting translate="title" module="ticketsystem">
|
| 68 |
+
<title>Settings</title>
|
| 69 |
+
<sort_order>4</sort_order>
|
| 70 |
+
<action>ticketsystem/adminhtml_setting</action>
|
| 71 |
+
</setting>
|
| 72 |
+
</children>
|
| 73 |
+
</ticketsystem>
|
| 74 |
+
</menu>
|
| 75 |
+
<acl>
|
| 76 |
+
<resources>
|
| 77 |
+
<admin>
|
| 78 |
+
<children>
|
| 79 |
+
<ticketsystem>
|
| 80 |
+
<title>TicketSystem</title>
|
| 81 |
+
<sort_order>30</sort_order>
|
| 82 |
+
<children>
|
| 83 |
+
<ticket translate="title">
|
| 84 |
+
<title>View Tickets</title>
|
| 85 |
+
</ticket>
|
| 86 |
+
<mail translate="title">
|
| 87 |
+
<title>Mail Responses</title>
|
| 88 |
+
</mail>
|
| 89 |
+
<cat translate="title">
|
| 90 |
+
<title>Departments</title>
|
| 91 |
+
</cat>
|
| 92 |
+
<setting translate="title">
|
| 93 |
+
<title>Settings</title>
|
| 94 |
+
</setting>
|
| 95 |
+
</children>
|
| 96 |
+
</ticketsystem>
|
| 97 |
+
</children>
|
| 98 |
+
</admin>
|
| 99 |
+
</resources>
|
| 100 |
+
</acl>
|
| 101 |
+
<translate>
|
| 102 |
+
<modules>
|
| 103 |
+
<MageTracking_TicketSystem>
|
| 104 |
+
<files>
|
| 105 |
+
<default>MageTracking_TicketSystem.csv</default>
|
| 106 |
+
</files>
|
| 107 |
+
</MageTracking_TicketSystem>
|
| 108 |
+
</modules>
|
| 109 |
+
</translate>
|
| 110 |
+
<layout>
|
| 111 |
+
<updates>
|
| 112 |
+
<ticketsystem>
|
| 113 |
+
<file>ticketsystem.xml</file>
|
| 114 |
+
</ticketsystem>
|
| 115 |
+
</updates>
|
| 116 |
+
</layout>
|
| 117 |
+
</adminhtml>
|
| 118 |
+
<global>
|
| 119 |
+
<models>
|
| 120 |
+
<ticketsystem>
|
| 121 |
+
<class>MageTracking_TicketSystem_Model</class>
|
| 122 |
+
<resourceModel>ticketsystem_mysql4</resourceModel>
|
| 123 |
+
</ticketsystem>
|
| 124 |
+
<ticketsystem_mysql4>
|
| 125 |
+
<class>MageTracking_TicketSystem_Model_Mysql4</class>
|
| 126 |
+
<entities>
|
| 127 |
+
<ticketsystem>
|
| 128 |
+
<table>mticketing_tickets</table>
|
| 129 |
+
</ticketsystem>
|
| 130 |
+
<mail>
|
| 131 |
+
<table>mticketing_settings</table>
|
| 132 |
+
</mail>
|
| 133 |
+
<cats>
|
| 134 |
+
<table>mticketing_categories</table>
|
| 135 |
+
</cats>
|
| 136 |
+
<messages>
|
| 137 |
+
<table>mticketing_messages</table>
|
| 138 |
+
</messages>
|
| 139 |
+
<answers>
|
| 140 |
+
<table>mticketing_answers</table>
|
| 141 |
+
</answers>
|
| 142 |
+
<!--<groups>
|
| 143 |
+
<table>mticketing_groups</table>
|
| 144 |
+
</groups>-->
|
| 145 |
+
<settings>
|
| 146 |
+
<table>mticketing_settings</table>
|
| 147 |
+
</settings>
|
| 148 |
+
</entities>
|
| 149 |
+
</ticketsystem_mysql4>
|
| 150 |
+
</models>
|
| 151 |
+
<resources>
|
| 152 |
+
<ticketsystem_setup>
|
| 153 |
+
<setup>
|
| 154 |
+
<module>MageTracking_TicketSystem</module>
|
| 155 |
+
</setup>
|
| 156 |
+
<connection>
|
| 157 |
+
<use>core_setup</use>
|
| 158 |
+
</connection>
|
| 159 |
+
</ticketsystem_setup>
|
| 160 |
+
<ticketsystem_write>
|
| 161 |
+
<connection>
|
| 162 |
+
<use>core_write</use>
|
| 163 |
+
</connection>
|
| 164 |
+
</ticketsystem_write>
|
| 165 |
+
<ticketsystem_read>
|
| 166 |
+
<connection>
|
| 167 |
+
<use>core_read</use>
|
| 168 |
+
</connection>
|
| 169 |
+
</ticketsystem_read>
|
| 170 |
+
</resources>
|
| 171 |
+
|
| 172 |
+
<blocks>
|
| 173 |
+
<customer>
|
| 174 |
+
<rewrite>
|
| 175 |
+
<account_navigation>MageTracking_TicketSystem_Block_Ticketsystem_Navigation</account_navigation>
|
| 176 |
+
<ticketsystem_view>MageTracking_TicketSystem_Block_Ticketsystem_View</ticketsystem_view>
|
| 177 |
+
<ticketsystem_edit>MageTracking_TicketSystem_Block_Ticketsystem_Edit</ticketsystem_edit>
|
| 178 |
+
</rewrite>
|
| 179 |
+
</customer>
|
| 180 |
+
<ticketsystem>
|
| 181 |
+
<class>MageTracking_TicketSystem_Block</class>
|
| 182 |
+
</ticketsystem>
|
| 183 |
+
</blocks>
|
| 184 |
+
|
| 185 |
+
<helpers>
|
| 186 |
+
<ticketsystem>
|
| 187 |
+
<class>MageTracking_TicketSystem_Helper</class>
|
| 188 |
+
</ticketsystem>
|
| 189 |
+
</helpers>
|
| 190 |
+
</global>
|
| 191 |
+
</config>
|
app/code/community/MageTracking/TicketSystem/sql/ticketsystem_setup/mysql4-install-1.2.1.php
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
|
| 7 |
+
$installer->run("
|
| 8 |
+
|
| 9 |
+
DROP TABLE IF EXISTS {$this->getTable('mticketing_answers')};
|
| 10 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mticketing_answers')} (
|
| 11 |
+
`ID` int(7) NOT NULL auto_increment,
|
| 12 |
+
`ticket` int(6) default '0',
|
| 13 |
+
`message` text collate utf8_turkish_ci,
|
| 14 |
+
`rep` int(5) NOT NULL default '0',
|
| 15 |
+
`reference` int(7) default NULL,
|
| 16 |
+
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
| 17 |
+
PRIMARY KEY (`ID`),
|
| 18 |
+
KEY `ticket` (`ticket`),
|
| 19 |
+
KEY `timestamp` (`timestamp`)
|
| 20 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci COMMENT='1.7.3' AUTO_INCREMENT=1 ;
|
| 21 |
+
|
| 22 |
+
DROP TABLE IF EXISTS {$this->getTable('mticketing_attachments')};
|
| 23 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mticketing_attachments')} (
|
| 24 |
+
`ID` int(7) NOT NULL auto_increment,
|
| 25 |
+
`ticket` int(6) NOT NULL default '0',
|
| 26 |
+
`ref` int(7) NOT NULL default '0',
|
| 27 |
+
`filename` varchar(100) collate utf8_turkish_ci NOT NULL default '',
|
| 28 |
+
`type` varchar(15) collate utf8_turkish_ci NOT NULL default '',
|
| 29 |
+
PRIMARY KEY (`ID`),
|
| 30 |
+
KEY `ticket` (`ticket`)
|
| 31 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci COMMENT='1.7.3' AUTO_INCREMENT=1 ;
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
DROP TABLE IF EXISTS {$this->getTable('mticketing_categories')};
|
| 35 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mticketing_categories')} (
|
| 36 |
+
`ID` int(5) NOT NULL auto_increment,
|
| 37 |
+
`name` varchar(100) collate utf8_turkish_ci NOT NULL default '',
|
| 38 |
+
`email` varchar(200) collate utf8_turkish_ci NOT NULL default '',
|
| 39 |
+
`signature` text collate utf8_turkish_ci NOT NULL,
|
| 40 |
+
`hidden` int(1) NOT NULL default '0',
|
| 41 |
+
`reply_method` varchar(7) collate utf8_turkish_ci NOT NULL default 'url',
|
| 42 |
+
PRIMARY KEY (`ID`)
|
| 43 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci COMMENT='1.7.3' AUTO_INCREMENT=7 ;
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
INSERT INTO {$this->getTable('mticketing_categories')} (`ID`, `name`, `email`, `signature`, `hidden`, `reply_method`) VALUES
|
| 47 |
+
(1, 'Support', 'localhost', '', 0, 'url');
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
DROP TABLE IF EXISTS {$this->getTable('mticketing_messages')};
|
| 51 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mticketing_messages')} (
|
| 52 |
+
`ID` int(7) NOT NULL auto_increment,
|
| 53 |
+
`ticket` int(6) NOT NULL default '0',
|
| 54 |
+
`message` text collate utf8_turkish_ci,
|
| 55 |
+
`headers` text collate utf8_turkish_ci,
|
| 56 |
+
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
| 57 |
+
PRIMARY KEY (`ID`),
|
| 58 |
+
KEY `ticket` (`ticket`)
|
| 59 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci COMMENT='1.7.3' AUTO_INCREMENT=1 ;
|
| 60 |
+
|
| 61 |
+
DROP TABLE IF EXISTS {$this->getTable('mticketing_settings')};
|
| 62 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mticketing_settings')} (
|
| 63 |
+
`ID` int(5) NOT NULL auto_increment,
|
| 64 |
+
`group` varchar(255) collate utf8_turkish_ci default NULL,
|
| 65 |
+
`key` varchar(255) collate utf8_turkish_ci NOT NULL,
|
| 66 |
+
`value` text collate utf8_turkish_ci NOT NULL,
|
| 67 |
+
PRIMARY KEY (`ID`),
|
| 68 |
+
KEY `GROUP` (`group`),
|
| 69 |
+
KEY `VALUE` (`key`)
|
| 70 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci COMMENT='1.7.3' AUTO_INCREMENT=85 ;
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
INSERT INTO {$this->getTable('mticketing_settings')} (`ID`, `group`, `key`, `value`) VALUES
|
| 74 |
+
(1, NULL, 'theme', 'eticket'),
|
| 75 |
+
(2, NULL, 'site_title', ''),
|
| 76 |
+
(3, NULL, 'charset', 'UTF-8'),
|
| 77 |
+
(4, NULL, 'presig', '\n\n'),
|
| 78 |
+
(5, NULL, 'short_date_format', 'm/d/Y'),
|
| 79 |
+
(6, NULL, 'answer_subj', '[#%ticket] %subject'),
|
| 80 |
+
(7, NULL, 'answer_msg', '%answer'),
|
| 81 |
+
(8, 'pri', '0', '1'),
|
| 82 |
+
(9, 'pri', '1', '2'),
|
| 83 |
+
(10, 'pri', '2', '3'),
|
| 84 |
+
(11, 'pri_text', '0', 'Low'),
|
| 85 |
+
(12, 'pri_text', '1', 'Normal'),
|
| 86 |
+
(13, 'pri_text', '2', 'High'),
|
| 87 |
+
(14, 'pri_style', '0', 'class=\"priLow\"'),
|
| 88 |
+
(15, 'pri_style', '1', 'class=\"priNormal\"'),
|
| 89 |
+
(16, 'pri_style', '2', 'class=\"priHigh\"'),
|
| 90 |
+
(17, NULL, 'rep_trans_response', '1'),
|
| 91 |
+
(18, NULL, 'rep_trans_subj', '[#%ticket] Representative Transfer'),
|
| 92 |
+
(19, NULL, 'rep_trans_msg', 'Ticket was transferred to representative %rep_name.'),
|
| 93 |
+
(20, NULL, 'nosubject', '[No Subject]'),
|
| 94 |
+
(21, NULL, 'ticket_format', '\\[#([0-9]{6})\\]'),
|
| 95 |
+
(22, NULL, 'subject_re', 'Re|Antw'),
|
| 96 |
+
(23, NULL, 'spamword', '[SPAM]'),
|
| 97 |
+
(24, NULL, 'flood_msg_rate', '10'),
|
| 98 |
+
(25, NULL, 'antispam_magicword', 'ANTI_SPAM_MAGICWORD'),
|
| 99 |
+
(26, NULL, 'antispam_subj', 'Ticked Rejected: Mail detected as SPAM'),
|
| 100 |
+
(27, NULL, 'antispam_msg', 'Your email was detected as spam and has been rejected. If your email was not spam, please re-send your email, including the word \"{MAGICWORD}\" in the body of the email.'),
|
| 101 |
+
(28, NULL, 'antispam_email', ''),
|
| 102 |
+
(29, NULL, 'accept_attachments', '0'),
|
| 103 |
+
(30, NULL, 'attachment_size', '1048576'),
|
| 104 |
+
(31, NULL, 'attachment_dir', ''),
|
| 105 |
+
(32, NULL, 'attachment_url', 'attachments.php'),
|
| 106 |
+
(33, NULL, 'search_disp', '1'),
|
| 107 |
+
(34, NULL, 'save_headers', '1'),
|
| 108 |
+
(35, NULL, 'time_format', 'l, F j Y g:ia'),
|
| 109 |
+
(36, NULL, 'min_interval', '60'),
|
| 110 |
+
(37, NULL, 'ticket_max', '10'),
|
| 111 |
+
(38, NULL, 'remove_original', '1'),
|
| 112 |
+
(39, NULL, 'remove_tag', '--please do not reply below this line--'),
|
| 113 |
+
(40, NULL, 'ticket_response', '1'),
|
| 114 |
+
(41, NULL, 'ticket_msg', 'A support ticket has been created (#%ticket). We will get back to you shortly.\r\n\r\nYou can view this ticket progress online here: %url/edit/id/%ticket\r\n\r\nNOTE: If you wish to send additional information regarding this ticket, please do not send another email. Instead, reply to this ticket.'),
|
| 115 |
+
(42, NULL, 'ticket_subj', '[#%ticket] Support Ticket Opened'),
|
| 116 |
+
(43, NULL, 'limit_response', '1'),
|
| 117 |
+
(44, NULL, 'limit_email', ''),
|
| 118 |
+
(45, NULL, 'limit_subj', 'Ticket Denied'),
|
| 119 |
+
(46, NULL, 'limit_msg', 'Ticket was not created for the email sent to %local_email from %user_email because there is a limit of %ticket_max open tickets per email address at any one time.\r\n\r\nTo be able to open another ticket, you must close one of your previous tickets first here:\r\n%url'),
|
| 120 |
+
(47, NULL, 'alert_new', '0'),
|
| 121 |
+
(48, NULL, 'alert_email', ''),
|
| 122 |
+
(49, NULL, 'alert_user', ''),
|
| 123 |
+
(50, NULL, 'alert_subj', '[#%ticket] New Message Alert'),
|
| 124 |
+
(51, NULL, 'alert_msg', 'There is a new message for ticket %ticket\r\n\r\nFrom: %email\r\n\r\n%url/edit/id/%ticket'),
|
| 125 |
+
(52, NULL, 'message_response', '1'),
|
| 126 |
+
(53, NULL, 'message_subj', '[#%ticket] Message Added'),
|
| 127 |
+
(54, NULL, 'message_msg', 'Your reply to support ticket #%ticket has been noted.\r\n\r\nYou can view this ticket progress online here: %url/edit/id/%ticket'),
|
| 128 |
+
(55, NULL, 'trans_response', '1'),
|
| 129 |
+
(56, NULL, 'trans_subj', '[#%ticket] Department Transfer'),
|
| 130 |
+
(57, NULL, 'trans_msg', 'Your ticket was transferred to the %cat_name department for further review.\r\n\r\n%trans_msg'),
|
| 131 |
+
(58, NULL, 'timezone', '0'),
|
| 132 |
+
(59, NULL, 'tickets_per_page', '10'),
|
| 133 |
+
(60, NULL, 'root_url', 'http://www.yourwebsitename.com/index.php/ticketsystem/index'),
|
| 134 |
+
(61, NULL, 'filetypes', '.jpg;.gif;.png;.pdf;.xls;.txt;.doc;.eml;.zip;.mp3;'),
|
| 135 |
+
(62, NULL, 'captcha_file', 'captcha.php'),
|
| 136 |
+
(63, NULL, 'accept_captcha', '0'),
|
| 137 |
+
(64, NULL, 'force_category', '0'),
|
| 138 |
+
(65, NULL, 'default_category', '1'),
|
| 139 |
+
(66, NULL, 'mail_method', 'mail'),
|
| 140 |
+
(67, NULL, 'smtp_host', 'localhost'),
|
| 141 |
+
(68, NULL, 'smtp_port', '25'),
|
| 142 |
+
(69, NULL, 'smtp_auth', '0'),
|
| 143 |
+
(70, NULL, 'smtp_user', 'user'),
|
| 144 |
+
(71, NULL, 'smtp_pass', 'pass'),
|
| 145 |
+
(72, NULL, 'show_badge', '1'),
|
| 146 |
+
(73, NULL, 'upgrade_check', '0'),
|
| 147 |
+
(74, NULL, 'last_check', '2009-01-01'),
|
| 148 |
+
(75, NULL, 'last_result', ''),
|
| 149 |
+
(76, NULL, 'activation_key', ''),
|
| 150 |
+
(77, NULL, 'sendmail_path', '/usr/sbin/sendmail'),
|
| 151 |
+
(78, NULL, '', ''),
|
| 152 |
+
(79, NULL, '', ''),
|
| 153 |
+
(80, NULL, '', ''),
|
| 154 |
+
(81, NULL, '', ''),
|
| 155 |
+
(82, NULL, '', ''),
|
| 156 |
+
(83, NULL, '', ''),
|
| 157 |
+
(84, NULL, '', '');
|
| 158 |
+
|
| 159 |
+
DROP TABLE IF EXISTS {$this->getTable('mticketing_tickets')};
|
| 160 |
+
CREATE TABLE IF NOT EXISTS {$this->getTable('mticketing_tickets')} (
|
| 161 |
+
`subject` varchar(255) collate utf8_turkish_ci NOT NULL default '[No Subject]',
|
| 162 |
+
`name` varchar(255) collate utf8_turkish_ci NOT NULL default '',
|
| 163 |
+
`email` varchar(255) collate utf8_turkish_ci NOT NULL default '',
|
| 164 |
+
`orders` varchar(255) collate utf8_turkish_ci default NULL,
|
| 165 |
+
`phone` varchar(20) collate utf8_turkish_ci default NULL,
|
| 166 |
+
`status` enum('new','onhold','custreplied','awaitingcustomer','reopened','closed') collate utf8_turkish_ci NOT NULL default 'new',
|
| 167 |
+
`ID` int(6) NOT NULL default '0',
|
| 168 |
+
`cat` int(5) NOT NULL default '0',
|
| 169 |
+
`priority` tinyint(1) NOT NULL default '2',
|
| 170 |
+
`ip` varchar(255) collate utf8_turkish_ci NOT NULL default '',
|
| 171 |
+
`trans_msg` varchar(255) collate utf8_turkish_ci NOT NULL default '',
|
| 172 |
+
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
| 173 |
+
PRIMARY KEY (`ID`),
|
| 174 |
+
KEY `timestamp` (`timestamp`)
|
| 175 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_turkish_ci COMMENT='1.7.3';
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
");
|
| 179 |
+
|
| 180 |
+
$installer->endSetup();
|
| 181 |
+
|
app/design/adminhtml/default/default/layout/ticketsystem.xml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<ticketsystem_adminhtml_ticketsystem_index>
|
| 4 |
+
<reference name="content">
|
| 5 |
+
<block type="ticketsystem/adminhtml_ticketsystem" name="ticketsystem" />
|
| 6 |
+
</reference>
|
| 7 |
+
</ticketsystem_adminhtml_ticketsystem_index>
|
| 8 |
+
|
| 9 |
+
<ticketsystem_adminhtml_cat_index>
|
| 10 |
+
<reference name="content">
|
| 11 |
+
<block type="ticketsystem/adminhtml_cat" name="cat" />
|
| 12 |
+
</reference>
|
| 13 |
+
</ticketsystem_adminhtml_cat_index>
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
<ticketsystem_adminhtml_rep_index>
|
| 17 |
+
<reference name="content">
|
| 18 |
+
<block type="ticketsystem/adminhtml_rep" name="rep" />
|
| 19 |
+
</reference>
|
| 20 |
+
</ticketsystem_adminhtml_rep_index>
|
| 21 |
+
</layout>
|
app/design/frontend/base/default/layout/ticketsystem.xml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout>
|
| 3 |
+
|
| 4 |
+
<default>
|
| 5 |
+
<reference name="content">
|
| 6 |
+
<block type="customer/ticketsystem_view" name="magetracking_ticketsystem_view" module="ticketsystem" template="ticketsystem/view.phtml"/>
|
| 7 |
+
</reference>
|
| 8 |
+
<reference name="left">
|
| 9 |
+
<block type="customer/account_navigation" name="magetracking_ticketsystem_navigation" before="-" template="ticketsystem/navigation.phtml">
|
| 10 |
+
<action method="addLink" translate="label" module="ticketsystem"><name>ticketsystem</name><path>ticketsystem/</path><label>Ticketing System</label></action>
|
| 11 |
+
</block>
|
| 12 |
+
</reference>
|
| 13 |
+
</default>
|
| 14 |
+
|
| 15 |
+
<ticketsystem_index_index>
|
| 16 |
+
<update handle="customer_account"/>
|
| 17 |
+
</ticketsystem_index_index>
|
| 18 |
+
|
| 19 |
+
<ticketsystem_index_edit>
|
| 20 |
+
|
| 21 |
+
<reference name="content">
|
| 22 |
+
<block type="customer/ticketsystem_edit" name="magetracking_ticketsystem_edit" template="ticketsystem/edit.phtml"/>
|
| 23 |
+
</reference>
|
| 24 |
+
</ticketsystem_index_edit>
|
| 25 |
+
<ticketsystem_index_add>
|
| 26 |
+
|
| 27 |
+
<reference name="content">
|
| 28 |
+
<block type="customer/ticketsystem_edit" name="magetracking_ticketsystem_add" template="ticketsystem/add.phtml"/>
|
| 29 |
+
</reference>
|
| 30 |
+
|
| 31 |
+
</ticketsystem_index_add>
|
| 32 |
+
|
| 33 |
+
<customer_logged_in>
|
| 34 |
+
<!--<update handle="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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 1.0
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
?>
|
| 23 |
+
<?php
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
$customer_id = Mage::getSingleton('customer/session')->getCustomer()->getId();
|
| 27 |
+
$orderCollection = Mage::getModel('sales/order')->getCollection()
|
| 28 |
+
->addFieldToFilter('customer_id', array('eq' => array($customer_id)));
|
| 29 |
+
$final_order = array();
|
| 30 |
+
$order_ids = array();
|
| 31 |
+
array_push($final_order, "Select Order");
|
| 32 |
+
foreach($orderCollection AS $order_row){
|
| 33 |
+
$order = $order_row->getData();
|
| 34 |
+
$order_data = "Order # ".$order['increment_id']." - Placed on ".$order['created_at']." for $".$order['subtotal_incl_tax'];
|
| 35 |
+
|
| 36 |
+
array_push($final_order, $order_data);
|
| 37 |
+
array_push($order_ids, $order['entity_id']);
|
| 38 |
+
}
|
| 39 |
+
?>
|
| 40 |
+
<div class="padder">
|
| 41 |
+
<?php if($this->getTitle(null)): ?>
|
| 42 |
+
|
| 43 |
+
<div class="head-alt2">
|
| 44 |
+
<h2 class="title"><?php echo $this->getTitle(null) ?></h2>
|
| 45 |
+
</div>
|
| 46 |
+
<div class="input-text">
|
| 47 |
+
<h5 ><?php echo $this->__('Ticket Add Instruction') ?></h5>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<br>
|
| 51 |
+
|
| 52 |
+
<?php endif;?>
|
| 53 |
+
|
| 54 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 55 |
+
<form action="<?php echo $this->getSaveUrl(0) ?>" method="post" id="form-validate">
|
| 56 |
+
<fieldset class="group-select">
|
| 57 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
| 58 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
| 59 |
+
|
| 60 |
+
<ul>
|
| 61 |
+
<li>
|
| 62 |
+
<div class="input-box">
|
| 63 |
+
<label for="name"><?php echo $this->__('Name') ?> <span class="required"></span></label><br />
|
| 64 |
+
<input type="text" name="name" value="<?php echo $this->getName() ?>" title="<?php echo $this->__('Name') ?>" class="required-entry input-text" id="name" />
|
| 65 |
+
</div>
|
| 66 |
+
</li>
|
| 67 |
+
<li>
|
| 68 |
+
<div class="input-box">
|
| 69 |
+
<label for="email"><?php echo Mage::helper('ticketsystem')->__('Email') ?> <span class="required"></span></label><br />
|
| 70 |
+
<input type="text" name="email" value="<?php echo $this->getEmail() ?>" title="<?php echo $this->__('Email') ?>" <?php if ($this->getEmail()<>'') { ?> readonly <?php } ?>class="required-entry input-text" id="email" />
|
| 71 |
+
</div>
|
| 72 |
+
</li>
|
| 73 |
+
<li>
|
| 74 |
+
<div class="input-box">
|
| 75 |
+
<label for="phone"><?php echo Mage::helper('ticketsystem')->__('Phone') ?> </label><br />
|
| 76 |
+
<input type="text" name="phone" value="" title="<?php echo $this->__('Phone') ?>" class="input-text" id="phone" />
|
| 77 |
+
</div>
|
| 78 |
+
</li>
|
| 79 |
+
<li>
|
| 80 |
+
<div class="box">
|
| 81 |
+
<label><?php echo Mage::helper('ticketsystem')->__('Select Department') ?></label><br/>
|
| 82 |
+
<select name="cat">
|
| 83 |
+
<?php foreach ($this->getDepartments() as $_code => $_name): ?>
|
| 84 |
+
<option value="<?php echo $_code ?>" >
|
| 85 |
+
<?php echo $_name->getName() ?>
|
| 86 |
+
</option>
|
| 87 |
+
<?php endforeach; ?>
|
| 88 |
+
</select>
|
| 89 |
+
</div>
|
| 90 |
+
</li>
|
| 91 |
+
<li>
|
| 92 |
+
<div style="width:350px;">
|
| 93 |
+
<label for="ordername">Select Order</label><br />
|
| 94 |
+
<input type="hidden" id="orderid">
|
| 95 |
+
<?php
|
| 96 |
+
|
| 97 |
+
$dropdown = '<select name="orders" onchange="document.getElementById(\'orderid\').value = this.value;">'."\n";
|
| 98 |
+
|
| 99 |
+
$selected = "";
|
| 100 |
+
/*** loop over the options ***/
|
| 101 |
+
foreach( $final_order as $key=>$option )
|
| 102 |
+
{
|
| 103 |
+
/*** assign a selected value ***/
|
| 104 |
+
$select = $selected==$key ? ' selected' : null;
|
| 105 |
+
|
| 106 |
+
/*** add each option to the dropdown ***/
|
| 107 |
+
$dropdown .= '<option value="'.$option.'"'.$select.'>'.$option.'</option>'."\n";
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
/*** close the select ***/
|
| 111 |
+
$dropdown .= '</select>'."\n";
|
| 112 |
+
|
| 113 |
+
?>
|
| 114 |
+
<?php echo $dropdown;?><br/>
|
| 115 |
+
</div>
|
| 116 |
+
</li>
|
| 117 |
+
<li>
|
| 118 |
+
<div style="width:350px;">
|
| 119 |
+
<label for="subject"><?php echo Mage::helper('ticketsystem')->__('Subject') ?> <span class="required"></span></label><br />
|
| 120 |
+
<input type="text" name="subject" value="" title="<?php echo Mage::helper('ticketsystem')->__('Subject') ?>" class="required-entry input-text" id="subject" />
|
| 121 |
+
</div>
|
| 122 |
+
</li>
|
| 123 |
+
|
| 124 |
+
<li>
|
| 125 |
+
<div class="input-box">
|
| 126 |
+
<label for="message"><?php echo Mage::helper('ticketsystem')->__('Message') ?> <span class="required"></span></label><br />
|
| 127 |
+
<textarea name="message" id="message" title="<?php echo $this->__('Message') ?>" class="required-entry" style="height:150px;width:525px;" cols="50" rows="5"></textarea>
|
| 128 |
+
</div>
|
| 129 |
+
</li>
|
| 130 |
+
<li>
|
| 131 |
+
<div class="box">
|
| 132 |
+
<label><?php echo Mage::helper('ticketsystem')->__('Priority') ?><span class="required"></span></label><br/>
|
| 133 |
+
<select name="priority">
|
| 134 |
+
<?php foreach ($this->getPriorities() as $_code => $_name): ?>
|
| 135 |
+
<option value="<?php echo $_code ?>" >
|
| 136 |
+
<?php echo $_name ?>
|
| 137 |
+
</option>
|
| 138 |
+
<?php endforeach; ?>
|
| 139 |
+
</select>
|
| 140 |
+
</div>
|
| 141 |
+
</li>
|
| 142 |
+
</ul>
|
| 143 |
+
</fieldset>
|
| 144 |
+
|
| 145 |
+
<div class="button-set">
|
| 146 |
+
<p class="required"><?php echo Mage::helper('ticketsystem')->__('* Required Fields') ?></p>
|
| 147 |
+
<a href="<?php echo $this->getBackUrl() ?>" class="f-left">« <?php echo $this->__('Back') ?></a>
|
| 148 |
+
<button class="form-button" type="submit"><span><?php echo $this->__('Save Ticket') ?></span></button>
|
| 149 |
+
</div>
|
| 150 |
+
</form>
|
| 151 |
+
|
| 152 |
+
<script type="text/javascript">
|
| 153 |
+
var contactForm = new VarienForm('form-validate', true);
|
| 154 |
+
</script>
|
| 155 |
+
</div>
|
app/design/frontend/base/default/template/ticketsystem/edit.phtml
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 1.0
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
?>
|
| 23 |
+
|
| 24 |
+
<?php $id= $this->getRequest()->getParam('id'); ?>
|
| 25 |
+
|
| 26 |
+
<div class="padder">
|
| 27 |
+
<?php if($this->getTitle($id)): ?>
|
| 28 |
+
|
| 29 |
+
<div class="head-alt2">
|
| 30 |
+
<h2 class="title"><?php echo $this->getTitle($id) ?></h2>
|
| 31 |
+
</div>
|
| 32 |
+
<div class="input-text">
|
| 33 |
+
<h5 ><?php echo $this->__('Ticket Edit Instruction') ?></h5>
|
| 34 |
+
</div>
|
| 35 |
+
|
| 36 |
+
<?php endif; ?>
|
| 37 |
+
|
| 38 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 39 |
+
|
| 40 |
+
<br>
|
| 41 |
+
|
| 42 |
+
<form action="<?php echo $this->getSaveUrl($id) ?>" method="post" id="form-validate">
|
| 43 |
+
<fieldset class="group-select">
|
| 44 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
| 45 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
| 46 |
+
<input type="hidden" name="rep" value="<?php echo $this->getTicket($id)->getRep() ?>" />
|
| 47 |
+
<input type="hidden" name="ID" value="<?php echo $id ?>" />
|
| 48 |
+
|
| 49 |
+
<ul>
|
| 50 |
+
<li>
|
| 51 |
+
<div class="input-text">
|
| 52 |
+
<label for="name"><?php echo $this->__('Name') ?> : </label><?php echo $this->htmlEscape($this->getTicket($id)->getName()) ?>
|
| 53 |
+
</div>
|
| 54 |
+
</li>
|
| 55 |
+
<li>
|
| 56 |
+
<div class="input-text">
|
| 57 |
+
<label for="email"><?php echo Mage::helper('ticketsystem')->__('Email') ?> : </label><?php echo $this->htmlEscape($this->getTicket($id)->getEmail()) ?>
|
| 58 |
+
</div>
|
| 59 |
+
</li>
|
| 60 |
+
<li>
|
| 61 |
+
<div class="input-text">
|
| 62 |
+
<label for="phone"><?php echo Mage::helper('ticketsystem')->__('Phone') ?> : </label><?php echo $this->htmlEscape($this->getTicket($id)->getPhone()) ?>
|
| 63 |
+
</div>
|
| 64 |
+
</li>
|
| 65 |
+
<li>
|
| 66 |
+
<div class="input-text">
|
| 67 |
+
<label for="phone"><?php echo Mage::helper('ticketsystem')->__('Department') ?> : </label><?php echo $this->htmlEscape($this->getDepartment($this->getTicket($id)->getCat()) ) ?>
|
| 68 |
+
</div>
|
| 69 |
+
</li>
|
| 70 |
+
<li>
|
| 71 |
+
<div class="input-text">
|
| 72 |
+
<label for="orders"><?php echo Mage::helper('ticketsystem')->__('Orders') ?> : </label><?php echo $this->htmlEscape($this->getTicket($id)->getOrders()) ?>
|
| 73 |
+
</div>
|
| 74 |
+
</li>
|
| 75 |
+
<li>
|
| 76 |
+
<div class="input-text">
|
| 77 |
+
<label for="subject"><?php echo Mage::helper('ticketsystem')->__('Subject') ?> : </label><?php echo $this->htmlEscape($this->getTicket($id)->getSubject()) ?>
|
| 78 |
+
</div>
|
| 79 |
+
</li>
|
| 80 |
+
<li>
|
| 81 |
+
<div class="input-text">
|
| 82 |
+
<label for="message"><?php echo Mage::helper('ticketsystem')->__('Message') ?> : </label><?php echo $this->getMessage($this->getTicket($id)->getId()) ?>
|
| 83 |
+
</div>
|
| 84 |
+
</li>
|
| 85 |
+
<li>
|
| 86 |
+
<div class="input-text">
|
| 87 |
+
<label for="priority"><?php echo Mage::helper('ticketsystem')->__('Priority') ?> : </label><?php echo $this->htmlEscape($this->getPriority($this->getTicket($id)->getPriority())) ?>
|
| 88 |
+
</div>
|
| 89 |
+
</li>
|
| 90 |
+
<li>
|
| 91 |
+
<div class="input-box">
|
| 92 |
+
<label for="answer"><?php echo Mage::helper('ticketsystem')->__('Customer Answer') ?> <span class="required"></span></label><br />
|
| 93 |
+
<textarea name="answer" id="answer" title="<?php echo $this->__('Answer') ?>" class="required-entry" style="height:150px;width:525px;" cols="50" rows="5"></textarea>
|
| 94 |
+
</div>
|
| 95 |
+
</li>
|
| 96 |
+
|
| 97 |
+
</ul>
|
| 98 |
+
</fieldset>
|
| 99 |
+
|
| 100 |
+
<div class="button-set">
|
| 101 |
+
<p class="required"><?php echo Mage::helper('ticketsystem')->__('* Required Fields') ?></p>
|
| 102 |
+
<a href="<?php echo $this->getBackUrl() ?>" class="f-left">« <?php echo $this->__('Back') ?></a>
|
| 103 |
+
<button class="form-button" type="submit"><span><?php echo $this->__('Update Ticket') ?></span></button>
|
| 104 |
+
</div>
|
| 105 |
+
</form>
|
| 106 |
+
<script type="text/javascript">
|
| 107 |
+
var contactForm = new VarienForm('form-validate', true);
|
| 108 |
+
</script>
|
| 109 |
+
</div>
|
app/design/frontend/base/default/template/ticketsystem/navigation.phtml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design_default
|
| 22 |
+
* @package Mage
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
<div class="block block-list block-compare">
|
| 28 |
+
<div class="block-title">
|
| 29 |
+
<?php $_links = $this->getLinks(); ?>
|
| 30 |
+
<?php $_index = 1; ?>
|
| 31 |
+
<?php $_count = count($_links); ?>
|
| 32 |
+
<?php foreach ($_links as $_link):?>
|
| 33 |
+
<?php $_last = ($_index++ >= $_count); ?>
|
| 34 |
+
<?php if ($this->isActive($_link)): ?>
|
| 35 |
+
<strong><span class="on<?php echo ($_last ? ' last' : '') ?>"><?php echo $_link->getLabel() ?></span></strong>
|
| 36 |
+
<?php else: ?>
|
| 37 |
+
<strong><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></strong>
|
| 38 |
+
<?php endif; ?>
|
| 39 |
+
<?php endforeach; ?>
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
</div>
|
app/design/frontend/base/default/template/ticketsystem/view.phtml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Sofhere SofTicket Magento Component
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the GNU (3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/gpl-3.0.html
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@sofhere.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* @category design_default
|
| 16 |
+
* @author sofhere.com
|
| 17 |
+
* @package Sofhere_SofTicket
|
| 18 |
+
* @copyright Copyright (c) 2008-2009 Sofhere IT Solutions.(http://www.sofhere.com)
|
| 19 |
+
* @version 1.0
|
| 20 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GNU 3.0)
|
| 21 |
+
*/
|
| 22 |
+
?>
|
| 23 |
+
|
| 24 |
+
<?php $_ticketsystems = $this->getTickets(); ?>
|
| 25 |
+
<?php if (is_null($_ticketsystems)) return; ?>
|
| 26 |
+
|
| 27 |
+
<div class="head-alt2">
|
| 28 |
+
<h2 class="title"><?php echo Mage::helper('ticketsystem')->__('Available Tickets') ?></h2>
|
| 29 |
+
</div>
|
| 30 |
+
<div class="input-text">
|
| 31 |
+
<h5 ><?php echo $this->__('Ticket View Instruction') ?></h5>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<br>
|
| 35 |
+
|
| 36 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 37 |
+
|
| 38 |
+
<table cellspacing="0" width="80%" class="data-table" id="my-softickets-table">
|
| 39 |
+
<thead>
|
| 40 |
+
<tr>
|
| 41 |
+
<th class="a-left"><?php echo Mage::helper('ticketsystem')->__('Date') ?></th>
|
| 42 |
+
<th><?php echo Mage::helper('ticketsystem')->__('Ticket ID') ?></th>
|
| 43 |
+
<th class="a-left"><?php echo Mage::helper('ticketsystem')->__('Subject') ?></th>
|
| 44 |
+
<!--<th class="a-left"><?php echo Mage::helper('ticketsystem')->__('Department') ?></th>-->
|
| 45 |
+
<th class="a-left"><?php echo Mage::helper('ticketsystem')->__('Priority') ?></th>
|
| 46 |
+
<th class="a-left"><?php echo Mage::helper('ticketsystem')->__('Status') ?></th>
|
| 47 |
+
</tr>
|
| 48 |
+
</thead>
|
| 49 |
+
<tbody>
|
| 50 |
+
<?php foreach($_ticketsystems as $_item): ?>
|
| 51 |
+
<?php
|
| 52 |
+
$id=$_item['ID'];
|
| 53 |
+
$timestamp=$_item['timestamp'];
|
| 54 |
+
$subject=$_item['subject'];
|
| 55 |
+
if (strlen($subject)>30)
|
| 56 |
+
$subject = substr($subject,0,30).'...';
|
| 57 |
+
$catId=$_item['cat'];
|
| 58 |
+
$priority=$_item['priority'];
|
| 59 |
+
$status=$_item['status'];
|
| 60 |
+
?>
|
| 61 |
+
<tr>
|
| 62 |
+
<td class="a-left"><?php echo $timestamp ?></td>
|
| 63 |
+
<td><a href="<?php echo $this->getUrl('ticketsystem/index/edit/id/'.$id) ?>" class="f-left"><?php echo $id ?></a></td>
|
| 64 |
+
<td class="a-left"><?php echo $subject ?></td>
|
| 65 |
+
<!-- <td class="a-left"><?php echo $this->getDepartment($catId) ?></td>-->
|
| 66 |
+
<td class="a-left"><?php echo $this->getPriority($priority) ?></td>
|
| 67 |
+
<td class="a-left"><?php echo $this->getStatus($status) ?></td>
|
| 68 |
+
</tr>
|
| 69 |
+
<?php endforeach ?>
|
| 70 |
+
</tbody>
|
| 71 |
+
</table>
|
| 72 |
+
|
| 73 |
+
<div class="button-set">
|
| 74 |
+
<input type="button" onclick="window.location='<?php echo $this->getUrl('ticketsystem/index/add') ?>';" value="<?php echo Mage::helper('ticketsystem')->__('New Ticket') ?>" class="input-button">
|
| 75 |
+
</div>
|
app/etc/modules/MageTracking_TicketSystem.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<MageTracking_TicketSystem>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</MageTracking_TicketSystem>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>MageTracking_TicketSystem</name>
|
| 4 |
+
<version>1.2.1</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Allow customers to post their queries and concerns to admin.</summary>
|
| 10 |
+
<description>Order specific queries with efficient tracking and resolution system.</description>
|
| 11 |
+
<notes>First stable release 1.2.1</notes>
|
| 12 |
+
<authors><author><name>Manmeet Kaur</name><user>Clariontech</user><email>manmeetkaur.g@gmail.com</email></author></authors>
|
| 13 |
+
<date>2014-11-14</date>
|
| 14 |
+
<time>13:49:47</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="MageTracking"><dir name="TicketSystem"><dir name="Block"><dir name="Adminhtml"><dir name="Cat"><file name="Cat.php" hash="586ba24b494352c2737f22444bb638fa"/><dir name="Edit"><file name="Form.php" hash="861a68ea410999d32205b56f869a2a0f"/><dir name="Tab"><file name="Form.php" hash="5ec9f8d2876a5b58ca632b78cb5ac152"/></dir><file name="Tabs.php" hash="4d7209a7d28f9f20fb6bd98652b7205a"/></dir><file name="Edit.php" hash="e04ee92f311571a6d0265833ac031c6f"/><file name="Grid.php" hash="5483324f04a45e8957b4d8bab15e9922"/></dir><file name="Cat.php" hash="6dc062e14609b2a3b763e9acc35fd6d2"/><dir name="Ticketsystem"><file name="Cat.php" hash="d45801a7c486f4df18ce1437ccde99e7"/><dir name="Edit"><file name="Form.php" hash="1f25f0333e481386cbcf5099c75fce43"/><file name="Newtabs.php" hash="46859b6191b44d2d508e5aa9a003b9ea"/><dir name="Tab"><file name="Form.php" hash="306caf6d3f2233dfce2226c85b3984a6"/><file name="Newform.php" hash="7d4cd6fb556ad0e4eea547d01603b60d"/></dir><file name="Tabs.php" hash="48c2bf68216b0ed06d8f73e66e3e1b05"/></dir><file name="Edit.php" hash="e38c8d8508240643c8c0649f1484c9f7"/><file name="Grid.php" hash="8e8a60f02618cbbe352019622d1fc9de"/><dir name="Mail"><file name="Form.php" hash="552147ea897b1f67c051f21c87db9c6f"/><dir name="Tab"><file name="Form.php" hash="c9f47b6a6f0749edfcee4184ee807bcd"/></dir><file name="Tabs.php" hash="cffc874837322729d18e0b2b55c9b4c2"/></dir><file name="Mail.php" hash="190acdad8799ea58c31784161596a51e"/><dir name="Setting"><file name="Form.php" hash="1cb9e541849d113916e6df8e7bda61bc"/><dir name="Tab"><file name="Form.php" hash="37cb541a3529f976161bc375261ff55d"/></dir><file name="Tabs.php" hash="7613b1ffd3e799f5ec0c64d15661b83c"/></dir><file name="Setting.php" hash="2b7845ced26a4359d31a2e8f74fff0bf"/></dir><file name="Ticketsystem.php" hash="e0dff574e88b1c88dfbecdadfc71552b"/></dir><file name="Cat.php" hash="82fa5c45eaa95a788e901a427ada99bd"/><dir name="Ticketsystem"><file name="Edit.php" hash="df8493197ade6b63b3da3ffaf735c223"/><file name="Navigation.php" hash="896d3c3e58467d3d35074260d85fb132"/><file name="View.php" hash="24d4cb2ec28a0485fdb01ffbc18a5b41"/></dir><file name="Ticketsystem.php" hash="877ec3cc25b5f4ed2f9945bcbc2a5b31"/></dir><dir name="Helper"><file name="Data.php" hash="55b634f3d5a2c7f192c5168856c4f31b"/><file name="Mail.php" hash="220e4e5191fc921e2d23d92bf4b3895c"/><file name="Mail_data.php" hash="d2639f1d0261ed766ccb6b44f6a221d2"/><file name="Phpmailer.php" hash="e80be7c6ad4edb2e31ef1252dae15164"/><file name="Smtp.php" hash="6b0ec32d145256df4b66e5f2f7baf355"/><file name="Ticket.php" hash="99828c0d2923c9d254998b60868723b0"/><file name="TicketFunctions.php" hash="66c9f5a9b82f133b27976ff2aa16479c"/><file name="email-example.html" hash="0db129d8958122d7b810793854e5fcc8"/></dir><dir name="Model"><file name="Answers.php" hash="6f918accfcd61009b054ce3e0c24fb28"/><file name="Cats.php" hash="3f0f1eb082e9c34b76e6db1e21f4e62f"/><file name="Groups.php" hash="ab1d418cfaf79a2da169d3ba7b33616f"/><file name="Mail.php" hash="d89c7d8cb549d877b9d0bebf93f31342"/><file name="Messages.php" hash="0befbd31c3f7dbab2158edcc14e4384d"/><dir name="Mysql4"><dir name="Answers"><file name="Collection.php" hash="cb71f90b2f9de9f16fc57eb2dc128f81"/></dir><file name="Answers.php" hash="cfafe1e43c93aea3f1d4de417c7b489a"/><dir name="Cats"><file name="Collection.php" hash="3d23bbdf2fa7f0137254f9cf5511813a"/></dir><file name="Cats.php" hash="fe3b00699c4d444f04a17dfd62b76e96"/><dir name="Groups"><file name="Collection.php" hash="2c805c01e413e44efe02828cb99d372c"/></dir><file name="Groups.php" hash="0fe54100d79f5fb91a88c7adf33c1de8"/><dir name="Mail"><file name="Collection.php" hash="0d455617b65f4163ad09d7aa16a688a5"/></dir><file name="Mail.php" hash="e1bed2c92e78bc8deb8706b100ac3846"/><file name="Messages.php" hash="95cf65b8a0e92a017a0917351a2b0130"/><dir name="Settings"><file name="Collection.php" hash="96f7e25a40958a4d1564a7ad179b8e02"/></dir><file name="Settings.php" hash="b202494080f477e11d48f18db29748da"/><dir name="Ticketsystem"><file name="Collection.php" hash="8af813dd7b207e844b151768024bc8dc"/></dir><file name="Ticketsystem.php" hash="fa19accedb52af3079c063899802f28a"/></dir><file name="Settings.php" hash="9f22a8dd293607d416d7b6c292f4982c"/><file name="Status.php" hash="1159148e85bec724c63eb309fb352c0d"/><file name="Ticketsystem.php" hash="07b956d364180b97a570acd60959b0d7"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CatController.php" hash="2fd02626293bb581afc8418d9912ebee"/><file name="MailController.php" hash="4a5f3d437bc504a7cc082b2d47b69440"/><file name="SettingController.php" hash="acdb0434338a7bf537396aabf0e53486"/><file name="TicketsystemController.php" hash="831e567a03e28196b773ae6d59b3451e"/></dir><file name="IndexController.php" hash="6e065b1c6fd0e1e22f0cd298c3b8d070"/></dir><dir name="etc"><file name="config.xml" hash="d625b4091612a46e64317b8e5c2495f1"/></dir><dir name="sql"><dir name="ticketsystem_setup"><file name="mysql4-install-1.2.1.php" hash="576484a23552cce0a5155964170d5b53"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ticketsystem.xml" hash="70ed75f80e1995356ad21caba5b8d590"/></dir><dir name="template"><dir name="ticketsystem"><file name="add.phtml" hash="03e0a35d9643fa556f3891ed1fa8722d"/><file name="edit.phtml" hash="cb2cd583027a179e9f8608a02dc1668a"/><file name="navigation.phtml" hash="1d77768501241b35557699d7c4d6eaf9"/><file name="view.phtml" hash="afbeb160eca02d464df9c88d4c5ea38d"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="ticketsystem.xml" hash="40713c5bc7867dd30a9a3966578d9217"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="MageTracking_TicketSystem.xml" hash="e7a0b88c04733e250385479c79a29f8b"/></dir></target></contents>
|
| 16 |
+
<compatible/>
|
| 17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
+
</package>
|
