| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/ptcfinance/application/controllers/ |
Upload File : |
<?php
/* * *************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name :IndexController.php
* File Description :Index controller for manage home page
* Created By : Praveen Kumar
* Created Date: 10-September-2014
* ************************************************************* */
class CmsController extends Zend_Controller_Action {
public function init() {
$messages = $this->_helper->flashMessenger->getMessages();
if (!empty($messages))
$this->_helper->layout->getView()->message = $messages[0];
/* Initialize action controller here */
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
//echo '<pre>'; print_r($aConfig); die;
$this->deviceBasePath = @$aConfig['deviceBasePath'];
$this->siteUrl = $aConfig['bootstrap']['siteUrl'];
$this->smtpUserName = $aConfig['smtpUserName'];
$this->smtpPassword = $aConfig['smtpPassword'];
$this->smtpPort = $aConfig['smtpPort'];
$this->smtpHost = $aConfig['smtpHost'];
$this->toEmailIR = @$aConfig['toEmailIR'];
$this->toEmailINFO = @$aConfig['toEmailINFO'];
$this->toEmailHR = @$aConfig['toEmailHR'];
$this->toName = $aConfig['toName'];
$controller_name = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$action_name = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
Zend_Session::start();
$cms = new Application_Model_Cms();
$page_details = $cms->getPageDetails();
$contact_details = $cms->getContactDetails();
$this->view->contactdetails = $contact_details;
$this->page_title = $page_details['page_title'];
$this->page_description = $page_details['page_description'];
$this->page_keywords = $page_details['page_keywords'];
//Start Code for tiled list menu on home page
$menu = new Application_Model_Menu();
//Start Code for tiled list menu on home page
$headerMenuData = $menu->getAllTopMenuList('content_menu');
// echo '<pre>';print_r($headerMenuData); die;
$this->view->headerMenu = $headerMenuData;
$footerMenuData = $menu->getAllTopMenuList('footer_menu_column1');
// echo "<pre>";print_r($footerMenuData);die;
$this->view->footerMenu = $footerMenuData;
}
/**
* index() method is used
* @param content_menu_link_id string
* @return object
*/
public function indexAction() {
//Start Code for quick menu
echo "index";
exit;
}
/**
* sitemap() method is used to dispaly sitemap
* @param NULL
* @return NULL
*/
public function sitemapAction() {
//Call Model Here
$menu = new Application_Model_Menu();
//Start sitemap code here
$this->view->headTitle()->prepend($this->page_title);
$this->view->headMeta()->appendName("description", $this->page_description);
$this->view->headMeta()->appendName("keyword", $this->page_keywords);
$menu_list = $menu->getAllMenuList();
// echo "<pre>";print_r($menu_list);die;
$this->view->menu_list = $menu_list;
//End sitemap code here
}
/**
* showpage() method is used to get all content menu and details by page url
* @param page string
* @return object
*/
public function showpageAction() {
$menu = new Application_Model_Menu();
$cms = new Application_Model_Cms();
$params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
if ($params['page'] == 'sitemap') {
$menu_list = $menu->getAllMenuList();
// echo "<pre>";print_r($menu_list);die;
$this->view->menu_list = $menu_list;
}
// echo "<pre>";print_r($params);die;
if ($params['page'] == 'career-opportunity-with-pfs' || $params['page'] == 'jobs-pfs' || $params['page'] == 'life-pfs' || $params['page'] == 'continuous-development') {
$form = new Application_Form_Submityourcvform();
} else {
$form = new Application_Form_Quickmessageform();
}
$this->view->form = $form;
$page_url = $this->getRequest()->getParam("page");
$ppage_url = $this->getRequest()->getParam("ppage");
//----------Get left menu by page url------------//
$getMenuData = $menu->getMenuListByPageUrl($page_url); //10,9
// echo $page_url.'<pre>';print_r($getMenuData);exit;
$this->view->parentId = $getMenuData;
$parent_details = $menu->getAllParentDetailsArrayById($getMenuData['parent_id']);
$this->view->parent_name = $parent_details['level'];
$this->view->parent_url = $parent_details['url'];
// echo '<pre>';print_r($parent_details);exit;
$checkChileList = $menu->getChildListById($getMenuData['id']);
// echo $checkChileList; die;
$this->view->checkChileList = $checkChileList;
if ($getMenuData['id'] != "" && ($getMenuData['parent_id'] == 0 && $getMenuData['parent_id'] != "")) {
// echo "roort yes";die;
$this->__getLeftMenuListById($getMenuData['id']);
} else if (@$getMenuData['id'] != "" && @$getMenuData['parent_id'] != 0) {
// echo "yes1"; die; //9,8
//Second Lb menu id
$getParentIdData = $menu->getLastParentIdByParentId(@$getMenuData['parent_id']);
// echo "<pre>";print_r($getParentIdData);
if (@$getParentIdData['id'] != "" && @$getParentIdData['parent_id'] != 0) {
//8,2
//Third Lb menu id
$this->view->also_vist = "third";
$getSubParentIdData = $menu->getLastParentIdByParentId(@$getParentIdData['parent_id']);
// echo "<pre>";print_r($getSubParentIdData);
if (@$getSubParentIdData['id'] != "" && @$getSubParentIdData['parent_id'] != 0) {
//2,0
//Fourth Lb menu id
$this->view->also_vist = "fourth";
$getSubSubParentIdData = $menu->getLastParentIdByParentId($getSubParentIdData['parent_id']);
//echo "<pre>";print_r($getSubSubParentIdData);
if (@$getSubSubParentIdData['id'] != "" && @$getSubSubParentIdData['parent_id'] != 0) {
//echo "fifth"; die;
} else if (@$getSubSubParentIdData['id'] != "" && (@$getSubSubParentIdData['parent_id'] == 0 && @$getSubSubParentIdData['parent_id'] != "")) {
//echo "root yes";die;
$this->__getLeftMenuListById(@$getSubSubParentIdData['id']);
}
} else if ($getSubParentIdData['id'] != "" && (@$getSubParentIdData['parent_id'] == 0 && @$getSubParentIdData['parent_id'] != "")) {
//echo "Third";die;
$this->__getLeftMenuListById($getSubParentIdData['id']);
}
} else if (@$getParentIdData['id'] != "" && (@$getParentIdData['parent_id'] == 0 && @$getParentIdData['parent_id'] != "")) {
$this->__getLeftMenuListById(@$getParentIdData['id']);
}
}
if ($page_url != "" && $ppage_url == "") {
$fpage_url = $page_url;
} else if ($page_url != "" && $ppage_url != "") {
$fpage_url = $ppage_url;
}
$page_content_data = $cms->getPageContentByPageUrl($page_url);
$page_content = $cms->getPageContentByPageUrl($fpage_url);
// echo $fpage_url."<pre>";print_r($page_content);die;
$template_type = $page_content['content_template_type'];
//----------Display Meta Title,Keywords and Description in view page---------------//
$meta_title = str_replace("Ptc", "PTC", ucwords(strtolower(@$page_content['meta_title'])));
if ($meta_title != "") {
$meta_title_val = $meta_title;
} else {
$meta_title_val = "PTC";
}
$meta_keywords = ucwords(strtolower(@$page_content['meta_keywords']));
$meta_description = ucwords(strtolower(@$page_content['meta_description']));
$this->view->headTitle()->prepend($this->page_title);
$this->view->headMeta()->appendName("description", $this->page_description);
$this->view->headMeta()->appendName("keyword", $this->page_keywords);
// echo "<pre>";print_r($page_content_data);die;
$this->view->page_content = $page_content;
// $page_content_menu_link_id = $page_content_data['content_menu_link_id'];
// $page_content_menu_list = $cms->getAllContentMenuList($page_content_menu_link_id);
$this->view->page_title = $page_content_data['page_title'];
$this->view->template_type = $template_type;
Zend_Session::start();
$s = new Zend_Session_Namespace('pageName');
$s->sess_page_name = $page_url;
$s->sess_ppage_name = $ppage_url;
$s->page_title = $page_content_data['page_title'];
$this->view->mainpage_key = $page_content_data['page_key'];
// $this->view->page_content_menu_list = @$page_content_menu_list;
if (($page_content_data['page_key'] == "board-of-directors") || $page_content_data['page_key'] == "our-team") {
$board_list = $cms->getBoardListByBoardType($page_content_data['page_key']);
$this->view->board_list = $board_list;
}
if ($page_content_data['page_key'] == "news-update") {
$news_list = $cms->getPressReleaseList($page_content_data['page_key'], 'id DESC');
$this->view->news_list = $news_list;
}
// echo "<pre>";print_r($news_list);die;
if ($page_content_data['page_key'] == "press-releases" || $page_content_data['page_key'] == "print-media" || $page_content_data['page_key'] == "electronic-media") {
$pressrelease_list = $cms->getPressReleaseList($page_content_data['page_key'], 'id DESC');
// echo "<pre>";print_r($pressrelease_list);die;
$this->view->pressrelease_list = $pressrelease_list;
$type = $page_content_data['page_key'];
$media_list = $cms->getMediaList($type);
$media_group = $cms->getMediaGroup($type);
// echo $template_type."<pre>";print_r($financialresult_list);die;
$this->view->media_list = $media_list;
$this->view->media_group = $media_group;
}
if ($page_content_data['page_key'] == "financial-results" || $page_content_data['page_key'] == "shareholding-pattern" || $page_content_data['page_key'] == "annual-reports" || $page_content_data['page_key'] == "grievances-redressal-mechanism" || $page_content_data['page_key'] == "codes-policies" || $page_content_data['page_key'] == "postal-ballot-result" || $page_content_data['page_key'] == "agm" || $page_content_data['page_key'] == "equity") {
$type = $page_content_data['page_key'];
$financialresult_list = $cms->getFinalResultList($type);
$financialresult_group = $cms->getFinalResultGroup($type);
$i = 0;
foreach ($financialresult_list as $value) { // print_r($value); die;
// $financialresult_list[] = $value;
$pathq = "upload/pdf/" . $value['Q'];
$filesizeq = $cms->filesize_formatted($pathq);
$financialresult_list[$i]['sizeq'] = $filesizeq;
$pathq1 = "upload/pdf/" . $value['Q1'];
$filesizeq1 = $cms->filesize_formatted($pathq1);
$financialresult_list[$i]['sizeq1'] = $filesizeq1;
$pathq2 = "upload/pdf/" . $value['Q2'];
$filesizeq2 = $cms->filesize_formatted($pathq2);
$financialresult_list[$i]['sizeq2'] = $filesizeq2;
$pathq3 = "upload/pdf/" . $value['Q3'];
$filesizeq3 = $cms->filesize_formatted($pathq3);
$financialresult_list[$i]['sizeq3'] = $filesizeq3;
$pathq4 = "upload/pdf/" . $value['Q4'];
$filesizeq4 = $cms->filesize_formatted($pathq4);
$financialresult_list[$i]['sizeq4'] = $filesizeq4;
$i++;
}
//echo $template_type."<pre>";print_r($financialresult_list);die;
$this->view->financialresult_list = $financialresult_list;
$this->view->financialresult_group = $financialresult_group;
}
if ($page_content_data['page_key'] == "corporate-governance" || $page_content_data['page_key'] == "debt-financing" || $page_content_data['page_key'] == "equity-investments" || $page_content_data['page_key'] == "financial-highlights" || $page_content_data['page_key'] == "grievances-redressal-mechanism") {
$type = $page_content_data['page_key'];
$corporate_list = $cms->getCorporateResultList($type);
$i = 0;
foreach ($corporate_list as $value) { //print_r($value['Q']); die;
$pathq = "upload/pdf/" . $value['Q'];
$filesizeq = $cms->filesize_formatted($pathq);
$corporate_list[$i]['sizeq'] = $filesizeq;
$i++;
}
$this->view->corporateresult_list = $corporate_list;
}
$ppage_url_int = (int) $ppage_url;
if ($page_url != "" && $ppage_url_int != "") {
$board_details = $cms->getBoardDetailsByBoardType($page_url, $ppage_url_int);
$this->view->page_content_data = $page_content_data;
$this->view->board_details = $board_details;
}
//echo $template_type; die;
if ($template_type == "left_side_menu_and_content") {
$this->render("template1");
} else if ($template_type == "board_of_directors") {
$this->render("template2");
} else if ($template_type == "our_team") {
$this->render("template3");
} else if ($template_type == "full_text_layout") {
$this->render("template4");
} else if ($template_type == "investor_three_parts_layout") {
$this->render("template5");
} else if ($template_type == "media_three_parts_layout") {
$this->render("template6");
} else if ($template_type == "contact_us_layout") {
$this->render("template7");
} else if ($template_type == "career_layout") {
$this->render("template8");
} else if ($template_type == "investor_three_parts_layout2") {
$this->render("template9");
} else if ($template_type == "agm_three_parts_layout") {
$this->render("template10");
} else {
$this->render("view");
}
}
/**
* __getLeftMenuListById() method is used to get all menu list by page url
* @param page string
* @return object
*/
private function __getLeftMenuListById($menu_id) {
//Start Code for quick menu
$menu = new Application_Model_Menu();
$firstlb_menus = $menu->getAllFirstLbMenuListById($menu_id);
$all_menu_list_arr = array();
foreach ($firstlb_menus as $firstlb_menus_list) {
$secondlb_menus = $menu->getAllSecondORThirdOrFourthLbMenuListById($firstlb_menus_list['id']);
$secondlb_menus_list_arr = array();
foreach ($secondlb_menus as $secondlb_menus_list) {
$thirdlb_menus = $menu->getAllSecondORThirdOrFourthLbMenuListById($secondlb_menus_list['id']);
$allthirdlb_menusarr = $menu->getAllThirdOrFourthLbMenuListArrayById($secondlb_menus_list['id']);
$allseclb_parentarr = $menu->getAllParentDetailsArrayById($secondlb_menus_list['parent_id']);
$thirdlb_menus_list_arr = array();
foreach ($thirdlb_menus as $thirdlb_menus_list) {
$fourthlb_menus = $menu->getAllSecondORThirdOrFourthLbMenuListById($thirdlb_menus_list['id']);
$allfourthlb_menusarr = $menu->getAllThirdOrFourthLbMenuListArrayById($thirdlb_menus_list['id']);
$allthirdlb_parentarr = $menu->getAllParentDetailsArrayById($thirdlb_menus_list['parent_id']);
$fourthlb_menus_list_arr = array();
foreach ($fourthlb_menus as $fourthlb_menus_list) {
$allfifthlb_menusarr = $menu->getAllThirdOrFourthLbMenuListArrayById($fourthlb_menus_list['id']);
$allfourthlb_parentarr = $menu->getAllParentDetailsArrayById($fourthlb_menus_list['parent_id']);
$fifthlb_menus_list_arr = array('life-term-plans', 'life-endowment-plans');
$fourthlb_menus_list_arr[] = array(
'id' => $fourthlb_menus_list['id'],
'parent_id' => $fourthlb_menus_list['parent_id'],
'level_name' => $fourthlb_menus_list['level'],
'sub_level_name' => $fourthlb_menus_list['sub_level_name'],
'url' => $fourthlb_menus_list['url'],
'external_url' => $fourthlb_menus_list['external_url'],
'image' => $fourthlb_menus_list['image'],
'fourthlb_parent_url' => $allfourthlb_parentarr['url'],
'fifthlb_menu_count' => 0,
'fifthlb_menu' => $fifthlb_menus_list_arr,
'fifthlb_submenu_url' => $allfifthlb_menusarr
);
}
$thirdlb_menus_list_arr[] = array(
'id' => $thirdlb_menus_list['id'],
'parent_id' => $thirdlb_menus_list['parent_id'],
'level_name' => $thirdlb_menus_list['level'],
'sub_level_name' => $thirdlb_menus_list['sub_level_name'],
'url' => $thirdlb_menus_list['url'],
'external_url' => $thirdlb_menus_list['external_url'],
'image' => $thirdlb_menus_list['image'],
'thirdlb_parent_url' => $allthirdlb_parentarr['url'],
'fourthlb_menu_count' => count($fourthlb_menus_list_arr),
'fourthlb_menu' => $fourthlb_menus_list_arr,
'fourthlb_submenu_url' => $allfourthlb_menusarr['sub_url']
);
}
$secondlb_menus_list_arr[] = array(
'id' => $secondlb_menus_list['id'],
'parent_id' => $secondlb_menus_list['parent_id'],
'level_name' => $secondlb_menus_list['level'],
'sub_level_name' => $secondlb_menus_list['sub_level_name'],
'url' => $secondlb_menus_list['url'],
'external_url' => $secondlb_menus_list['external_url'],
'image' => $secondlb_menus_list['image'],
'seclb_parent_url' => $allseclb_parentarr['url'],
'thirdlb_menu_count' => count($thirdlb_menus_list_arr),
'thirdlb_menu' => $thirdlb_menus_list_arr,
'thirdlb_submenu_url' => $allthirdlb_menusarr['sub_url']
);
}
$all_menu_list_arr[] = array(
'id' => $firstlb_menus_list['id'],
'parent_id' => $firstlb_menus_list['parent_id'],
'level_name' => $firstlb_menus_list['level'],
'sub_level_name' => $firstlb_menus_list['sub_level_name'],
'url' => $firstlb_menus_list['url'],
'external_url' => $firstlb_menus_list['external_url'],
'image' => $firstlb_menus_list['image'],
'secondlb_menu_count' => count($secondlb_menus_list_arr),
'secondlb_menu' => $secondlb_menus_list_arr
);
}
// echo "<pre>";print_r($all_menu_list_arr);die;
$this->view->all_leftmenu_list = $all_menu_list_arr;
}
public function getsearchAction() {
$options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('bootstrap');
$this->_helper->layout()->disableLayout('');
if ($this->_request->isXmlHttpRequest()) {
$type = $this->getRequest()->getParam('type');
$title = $this->getRequest()->getParam('title');
$cms = new Application_Model_Cms();
$typeList = $cms->getSearchResultTypeId($type, $title);
$i = 0;
foreach ($typeList as $value) { //print_r($value['Q']); die;
// $financialresult_list[] = $value;
$pathq = "upload/pdf/" . $value['Q'];
$filesizeq = $cms->filesize_formatted($pathq);
$typeList[$i]['sizeq'] = $filesizeq;
$pathq1 = "upload/pdf/" . $value['Q1'];
$filesizeq1 = $cms->filesize_formatted($pathq1);
$typeList[$i]['sizeq1'] = $filesizeq1;
$pathq2 = "upload/pdf/" . $value['Q2'];
$filesizeq2 = $cms->filesize_formatted($pathq2);
$typeList[$i]['sizeq2'] = $filesizeq2;
$pathq3 = "upload/pdf/" . $value['Q3'];
$filesizeq3 = $cms->filesize_formatted($pathq3);
$typeList[$i]['sizeq3'] = $filesizeq3;
$pathq4 = "upload/pdf/" . $value['Q4'];
$filesizeq4 = $cms->filesize_formatted($pathq4);
$typeList[$i]['sizeq4'] = $filesizeq4;
$i++;
}
// echo "<pre>";print_r($typeList);die;
$input = '';
if ($type != '') {
foreach ($typeList as $valueList) {
$Qfie = $options['siteUrl'] . 'upload/pdf/' . $valueList['Q'];
$input .= '<tr>
<td>' . $valueList['subTitle'] . '</td>
<td><a href="' . $Qfie . '" target="_blank" class="view">View</a> /
<a href="' . $Qfie . '" target="_blank" class="download" download="">Download</a>
</td>
<td><a href="' . $Qfie . '" class="pdfIcon">(' . $valueList['sizeq'] . ')</a></td></tr>';
}
} else {
$input .= '<tr><td colspan = "3">No data found.</td></tr>';
}
echo $input;
}
exit;
}
public function getsearchmediaAction()
{
$options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('bootstrap');
$this->_helper->layout()->disableLayout('');
if ($this->_request->isXmlHttpRequest()) {
$type = $this->getRequest()->getParam('type');
$title = $this->getRequest()->getParam('title');
$cms = new Application_Model_Cms();
$typeList = $cms->getSearchMediaTypeId($type, $title);
//echo "<pre>";print_r($typeList);die;
if (($type == 'electronic-media') || ($type == 'print-media')) {
if(count($typeList)>0) {
foreach ($typeList as $list) {
if($list['type'] == 'file'){
$extUrl = $options['siteUrl'].'upload/press_release/'.$list['file_name'];
}else{
$extUrl = $list['externalLink'];
}
$input .= '<tr>
<td>' . date('M d, Y', strtotime($list['press_release_date'])) . '</td>
<td>' . $list['publication'] . '</td>
<td>' . $list['press_release_short_description'] . '</td>
<td><a href="' . $extUrl . '" style="background:none; padding:0;" target="_blank"><img src="' . $options['siteUrl'] . 'images/view-bg.jpg" border="0"></a></td>
</tr>';
} } else {
$input .= '<tr><td colspan = "4">No data found.</td></tr>';
}
}
if ($type == 'press-releases') {
if(count($typeList)>0){
foreach ($typeList as $list) {
if($list['type'] == 'file'){
$extUrl = $options['siteUrl'].'upload/press_release/'.$list['file_name'];
}else{
$extUrl = $list['externalLink'];
}
$input .= '<tr>
<td>' . date('M d, Y', strtotime($list['press_release_date'])) . '</td>
<td>' . $list['press_release_short_description'] . '</td>
<td><a href="' . $extUrl . '" style="background:none; padding:0;" target="_blank"><img src="' . $options['siteUrl'] . 'images/view-bg.jpg" border="0"></a></td>
</tr>';
} } else {
$input .= '<tr><td colspan = "3">No data found.</td></tr>';
}
}
echo $input;
}
exit;
}
public function sanitize_data($input_data) {
$searchArr = array("document", "write", "alert", "%", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "AND", "JAVASCRIPT");
$input_data = str_replace("script", "", $input_data);
$input_data = str_replace("iframe", "", $input_data);
$input_data = str_replace($searchArr, "", $input_data);
return htmlentities(stripslashes($input_data), ENT_QUOTES);
}
public function sanitize_data_file($input_data) {
$searchArr = array("document", "&", " ", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "AND", "JAVASCRIPT");
$input_data = str_replace("script", "", $input_data);
$input_data = str_replace("&", "-", $input_data);
$input_data = str_replace(" ", "-", $input_data);
$input_data = str_replace($searchArr, "", $input_data);
return htmlentities(stripslashes($input_data), ENT_QUOTES);
}
public function submityourcvAction()
{
$cms = new Application_Model_Cms();
$form = new Application_Form_Submityourcvform();
$this->view->form = $form;
$request = $this->getRequest();
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
if ($getData) {
if (strtolower($getData['captcha']) != $_SESSION['captcha'])
{
$result = ['status' => false, 'message' => 'Invalid captcha!', 'newcaptcha' => $_SESSION['captcha']];
echo Zend_Json::encode($result);
exit;
}
//Code to to integrate different email for different action
if($getData['url']!="")
{
if(@$getData['url']=='financial-highlights' || @$getData['url']=='financial-results' || @$getData['url']=='annual-reports' || @$getData['url']=='credit-rating' || @$getData['url']=='investor-contacts-grievances'){
$toEmail = $this->toEmailIR;
$toName = 'IR';
}
else if(@$getData['url']=='career-opportunity-with-pfs' || @$getData['url']=='continuous-development' || @$getData['url']=='life-pfs' || @$getData['url']=='jobs-pfs'){
$toEmail = $this->toEmailHR;
$toName = 'HR';
}else {
$toEmail = $this->toEmailINFO;
$toName = 'INFO';
}
} else {
$toEmail = $this->toEmailINFO;
$toName = 'INFO';
}
$orignalFIleName = $_FILES['image']['tmp_name'];
$ext = @substr($_FILES['image']['name'], strrpos($_FILES['image']['name'], '.'));
$image = "quick_message_" . time() . $ext;
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination("upload/quick_message/");
$upload->addFilter('Rename', "upload/quick_message/" . $image);
$file = $upload->getFileName();
//$file_name = str_replace(" ","-",$_FILES['image']['name']);
$filePath = "upload/quick_message/" . $image;
if ($orignalFIleName != "") {
$addfile = $image;
} else {
$addfile = "";
}
if($getData['query']!="")
{
$query_str = $getData['query'];
$subject = "Quick Message";
} else {
$query_str = "";
$subject = "Submit your CV";
}
try {
$upload->receive();
$dataArray = array(
'message_type' => 'SubmitYourCv',
'firstName' => $this->sanitize_data($getData['fname']),
'email' => $this->sanitize_data($getData['email']),
'phoneNumber' => $this->sanitize_data($getData['mobile_no']),
'query' => $this->sanitize_data($getData['query']),
'file_name' => $this->sanitize_data($addfile),
'createdOn' => time()
);
//echo "<pre>";print_r($dataArray);die;
$cms->add($dataArray);
$Name = ucfirst($this->sanitize_data($getData['fname']));
$Email = $this->sanitize_data($getData['email']);
$mobile = $this->sanitize_data($getData['mobile_no']);
$upload = $this->sanitize_data($addfile);
$to = $toEmail;
//$to = "abinash@catpl.co.in";
//$cc = "abinash@catpl.co.in";
$bcc = "admin@ptcfinancial.com";
//Mail Send for ptcfinancial
$page_url = $this->siteUrl.'cms/showpage/page/'.$getData['url'];
$bodytext = "Hi, <br><br>";
if($query_str!="")
{
$bodytext .= "Details Of Form Submission(Quick Message) <br>";
} else {
$bodytext .= "Details Of Form Submission(Submit your CV) <br>";
}
$bodytext .= "Name : $Name<br>";
$bodytext .= "Email : $Email<br>";
$bodytext .= "Mobile No. : $mobile<br>";
if($query_str!="")
{
$bodytext .= "Query : $query_str<br>";
}
$bodytext .= "Page Name Url : $page_url<br>";
$bodytext .= "Please find attached document<br><br>";
$bodytext .= "Thanks,<br>";
$bodytext .= "$Name";
//Start code fot smtp mail details
$random_hash = md5(date('r', time()));
if ($image != '') {
$file_to_attach = $filePath;
$headers = "From: $Email \r\nReply-To: $Email";
//$headers .= "\r\nCc: $cc";
$headers .= "\r\nBcc: $bcc";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-" . $random_hash . "\"";
$attachment = chunk_split(base64_encode(file_get_contents($file_to_attach))); // Set your file path here
$message = "--PHP-mixed-$random_hash\r\n" . "Content-Type: multipart/alternative; boundary=\"PHP-alt-$random_hash\"\r\n\r\n";
$message .= "--PHP-alt-$random_hash\r\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\r\n" . "Content-Transfer-Encoding: 7bit\r\n\r\n";
$message .= $bodytext;
$message .="\r\n\r\n--PHP-alt-$random_hash--\r\n\r\n";
$message .= "--PHP-mixed-$random_hash\r\n" . "Content-Type: application/pdf; name=\"$image\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment\r\n\r\n";
$message .= $attachment;
$message .= "/r/n--PHP-mixed-$random_hash--";
//echo $message; exit;
} else {
$headers = "From: $Email\r\nReply-To: $Email";
$headers .= "\r\nCc: $cc";
$headers .= "\r\nBcc: $bcc";
$headers .= "\r\nContent-Type: text/html; charset=\"iso-8859-1\" boundary=\"PHP-mixed-" . $random_hash . "\"";
$message = $bodytext;
}
try {
$mail = @mail($to, $subject, $message, $headers);
} catch (Exception $ex)
{
print_r($e, true);
}
$this->_redirect('cms/showpage/page/thank-you');
} catch(Exception $e) {
print_r($e, false);
$this->_helper->redirector('showpage', 'cms', 'default', array('page' => $getData['url']));
}
} else {
die("Form not valid"); exit;
}
}
}
/**
* quickmessage() method is used to send quick messages
* @param page string
* @return object
*/
public function quickmessageAction() {
$cms = new Application_Model_Cms();
$form = new Application_Form_Quickmessageform();
$params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
$this->view->form = $form;
$request = $this->getRequest();
if ($this->getRequest()->isPost()) {
$getData = $this->getRequest()->getPost();
if ($getData) {
//echo '<pre>'; print_r($getData);
if (strtolower($getData['captcha']) != $_SESSION['captcha'])
{
$this->_helper->flashMessenger->addMessage("Captcha code is Invalid.");
?><script>$('#message_box').html('Captcha code is Invalid');</script><?php
//$this->_helper->redirector('showpage', 'cms', 'default', array('page'=>$params['page']));
$this->_redirect($request->getHeader('referer'));
} else {
//Code to to integrate different email for different action
if($getData['url']!="")
{
if($getData['url']=='financial-highlights' || $getData['url']=='financial-results' || $getData['url']=='annual-reports' || $getData['url']=='credit-rating' || $getData['url']=='investor-contacts-grievances'){
$toEmail = $this->toEmailIR;
$toName = 'IR';
}
else if($getData['url']=='career-opportunity-with-pfs' || $getData['url']=='continuous-development' || $getData['url']=='life-pfs' || $getData['url']=='jobs-pfs'){
$toEmail = $this->toEmailHR;
$toName = 'HR';
}else {
$toEmail = $this->toEmailINFO;
$toName = 'INFO';
}
} else {
$toEmail = $this->toEmailINFO;
$toName = 'INFO';
}
//echo $toEmail;
$orignalFIleName = $_FILES['image']['tmp_name'];
$ext = @substr($_FILES['image']['name'], strrpos($_FILES['image']['name'], '.'));
$image = "quick_message_" . time() . $ext;
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination("upload/quick_message/");
$upload->addFilter('Rename', "upload/quick_message/" . $image);
$file = $upload->getFileName();
//$file_name = str_replace(" ","-",$_FILES['image']['name']);
$filePath = "upload/quick_message/" . $image;
if ($orignalFIleName != "") {
$addfile = $image;
} else {
$addfile = "";
}
try {
$upload->receive();
$dataArray = array(
'message_type' => 'QuickMessage',
'firstName' => $this->sanitize_data($getData['fname']),
'email' => $this->sanitize_data($getData['email']),
'phoneNumber' => $this->sanitize_data($getData['mobile_no']),
'query' => $this->sanitize_data($getData['query']),
'file_name' => $this->sanitize_data($addfile),
'createdOn' => time()
);
//$cms->add($dataArray);
//echo '<pre>'; print_r($dataArray);
// Start code for send document attachment
$Name = ucfirst($this->sanitize_data($getData['fname']));
$Email = $this->sanitize_data($getData['email']);
$mobile = $this->sanitize_data($getData['mobile_no']);
$query = $this->sanitize_data($getData['query']);
$subject_quick = "Query/Suggestion";
//$to_email = $toEmail;
$to_email = "praveen0806@gmail.com";
$cc = "praveen@catpl.co.in";
//Mail Send for ptcfinancial
$page_url = $this->siteUrl.'cms/showpage/page/'.$getData['url'];
$bodytextqu = "Hi, <br><br>";
$bodytextqu .= "Details Of Form Submission(Quick Message) <br>";
$bodytextqu .= "Name : $Name<br>";
$bodytextqu .= "Email : $Email<br>";
$bodytextqu .= "Mobile No. : $mobile<br>";
$bodytextqu .= "Query : $query<br>";
$bodytextqu .= "Page Name Url : $page_url<br>";
$bodytextqu .= "Please find attached document<br><br>";
$bodytextqu .= "Thanks,<br>";
$bodytextqu .= "$Name";
//echo $bodytextqu;
//Start code fot smtp mail details
$random_hash = md5(date('r', time()));
if ($image != '') {
$file_to_attach = $filePath;
$headers = "From: info@ptcfinancial.com \r\n";
//$headers .= "\r\nCc: $cc";
$headers .= "Content-Type: multipart/mixed; boundary=\"PHP-mixed-" . $random_hash . "\"";
$attachment = chunk_split(base64_encode(file_get_contents($file_to_attach))); // Set your file path here
$message = "--PHP-mixed-$random_hash\r\n" . "Content-Type: multipart/alternative; boundary=\"PHP-alt-$random_hash\"\r\n\r\n";
$message .= "--PHP-alt-$random_hash\r\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\r\n" . "Content-Transfer-Encoding: 7bit\r\n\r\n";
$message .= $bodytextqu;
$message .="\r\n\r\n--PHP-alt-$random_hash--\r\n\r\n";
$message .= "--PHP-mixed-$random_hash\r\n" . "Content-Type: application/pdf; name=\"$image\"\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment\r\n\r\n";
$message .= $attachment;
$message .= "/r/n--PHP-mixed-$random_hash--";
//echo $message; exit;
} else {
$headers = "From: info@ptcfinancial.com\r\n";
$headers .= "Cc: $cc\r\n";
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\" boundary=\"PHP-mixed-" . $random_hash . "\"";
$message = $bodytextqu;
}
try {
$to = "praveen0806@gmail.com";
if(!@mail($to, $subject, $message, $headers)) {
die("Error in sendign mail");
}else {
echo "Success";exit;
}
} catch (Exception $ex)
{
print_r($ex, false);
}
$this->_redirect('cms/showpage/page/thank-you');
} catch(Exception $e) {
print_r($e, false);
$this->_helper->redirector('showpage', 'cms', 'default', array('page' => $getData['url']));
}
}
}
$this->_helper->flashMessenger->addMessage("Invalid.");
$this->_redirect($request->getHeader('referer'));
}
}
function testmailAction() {
//$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout()->disableLayout('');
// $config_details = array(
// 'auth' => 'login',
// 'port' => $this->smtpPort,
// 'username' => "pooja@catpl.co.in",
// 'password' => $this->smtpPassword
// );
//require_once $this->deviceBasePath . 'library/Zend/Mail.php';
//require_once $this->deviceBasePath . 'library/Zend/Mail/Transport/Smtp.php';
$config = array('auth' => 'login',
'port' => 25,
'username' => "pooja@catpl.co.in",
'password' => "PjCat@#6328");
$transport = new Zend_Mail_Transport_Smtp("mail.catpl.co.in", $config);
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('pooja@catpl.co.in', 'Some Sender');
$mail->addTo('praveen@catpl.co.in', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);
//echo '<pre>'; print_r($mail);
}
}