/** * Arguments * array('chat' => & $chat) * */ public function telegram($params) { $conf = (include 'extension/telegram/settings/settings.ini.php'); $url = 'http://api.telegram.org/bot' . $conf['telegramBot'] . '/sendMessage?parse_mode=Markdown'; $chat = $params['chat']; foreach ($conf['receivers'] as $receiver) { $internalurl = $url . "&chat_id=" . preg_replace('/[^0-9.]+/', '', $receiver['chatid']); $text = "``` Nova solicitação de suporte via chat - "; $text = isset($chat->nick) ? $text . $chat->nick : $text; $text = isset($chat->email) ? $text . " ( " . $chat->email . " )" : $text; $text .= "```"; if (isset($receiver['operator'])) { $veryfyEmail = sha1(sha1($receiver['operator'] . $secretHash) . $secretHash); $link = erLhcoreClassXMP::getBaseHost(); $link .= $_SERVER['HTTP_HOST']; $link .= erLhcoreClassDesign::baseurl('chat/accept') . '/'; $link .= erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/'; $link .= $veryfyEmail . '/' . $receiver['operator']; $text .= "\n" . $link; } $text .= "```"; $internalurl .= "&text=" . urlencode($text); file_get_contents($internalurl); } }
public function getFormattedContent() { $dataCollected = array(); foreach ($this->content_array as $nameAttr => $contentArray) { if (isset($contentArray['definition']['type']) && $contentArray['definition']['type'] == 'file') { $dataCollected[] = $contentArray['definition']['name_literal'] . " - " . erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('user/login') . '/(r)/' . rawurlencode(base64_encode('form/download/' . $this->id . '/' . $nameAttr)); } elseif (isset($contentArray['definition']['type']) && $contentArray['definition']['type'] == 'checkbox') { $dataCollected[] = $contentArray['definition']['name_literal'] . " - " . ($contentArray['value'] == 1 ? 'Y' : 'N'); } else { $dataCollected[] = $contentArray['definition']['name_literal'] . " - " . $contentArray['value']; } } return implode("\n", $dataCollected); }
public static function chatListExportXLS($chats) { include 'lib/core/lhform/PHPExcel.php'; $objPHPExcel = new PHPExcel(); $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->getStyle('A1:AW1')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->setTitle('Report'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, "ID"); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Visitor Name')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'E-mail')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Phone')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Country')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'City')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'IP')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Operator')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Department')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Date')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Mail send')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Referrer')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(12, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Link')); $attributes = array('id', 'nick', 'email', 'phone', 'country_name', 'city', 'ip', 'user', 'department'); $i = 2; foreach ($chats as $item) { foreach ($attributes as $key => $attr) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, (string) $item->{$attr}); } $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, date(erLhcoreClassModule::$dateFormat, $item->time)); $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $item->mail_send == 1 ? 'Yes' : 'No'); $key++; if ($item->session_referrer != '') { $referer = parse_url($item->session_referrer); if (isset($referer['host'])) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $referer['host']); } } $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, "URL"); $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($key, $i)->getHyperlink()->setUrl(erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('user/login') . '/(r)/' . rawurlencode(base64_encode('chat/single/' . $item->id))); $i++; } $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); // We'll be outputting an excel file header('Content-type: application/vnd.ms-excel'); // It will be called file.xls header('Content-Disposition: attachment; filename="report.xlsx"'); // Write file to the browser $objWriter->save('php://output'); }
/** * Arguments * array('chat' => & $chat) * */ public function sevabot($params) { $settings = (include 'extension/sevabot/settings/settings.ini.php'); // Format message content $chat = $params['chat']; $messages = array_reverse(erLhcoreClassModelmsg::getList(array('limit' => 5, 'sort' => 'id DESC', 'filter' => array('chat_id' => $chat->id)))); $messagesContent = ''; foreach ($messages as $msg) { if ($msg->user_id == -1) { $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n"; } else { $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($chat->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n"; } } $cfgSite = erConfigClassLhConfig::getInstance(); $secretHash = $cfgSite->getSetting('site', 'secrethash'); $chatDataItems = $settings['chat']; if (isset($settings['chat_dep'][$chat->dep_id]) && !empty($settings['chat_dep'][$chat->dep_id])) { $chatDataItems = array_merge($chatDataItems, $settings['chat_dep'][$chat->dep_id]); } // Global notifications foreach ($chatDataItems as $chatData) { $veryfyEmail = sha1(sha1($chatData['email'] . $secretHash) . $secretHash); $msgParsed = str_replace(array('{messages}', '{url_accept}', '{chat_id}', '{user_name}'), array($messagesContent, erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('chat/accept') . '/' . erLhcoreClassModelChatAccept::generateAcceptLink($chat) . '/' . $veryfyEmail . '/' . $chatData['email'], $chat->id, $chat->user_name), $settings['msg']); $md5 = md5($chatData['chat_id'] . $msgParsed . $settings['sevabot_secret']); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $settings['url']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, array('md5' => $md5, 'msg' => $msgParsed, 'chat' => $chatData['chat_id'])); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Some hostings produces wargning... $content = curl_exec($ch); if ($content != 'OK') { erLhcoreClassLog::write(print_r($content, true)); } } }
public static function informFormFilled($formCollected, $params = array()) { $sendMail = erLhAbstractModelEmailTemplate::fetch(8); $mail = new PHPMailer(); $mail->CharSet = "UTF-8"; if ($sendMail->from_email != '') { $mail->From = $mail->Sender = $sendMail->from_email; } if (isset($params['email']) && $params['email'] !== false && $params['email'] != '') { $mail->AddReplyTo($params['email']); } $mail->FromName = $sendMail->from_name; $mail->Subject = str_replace(array('{form_name}'), array($formCollected->form), $sendMail->subject); $mail->Body = str_replace(array('{identifier}', '{form_name}', '{content}', '{ip}', '{url_download}', '{url_view}'), array($formCollected->identifier, (string) $formCollected->form, $formCollected->form_content, $formCollected->ip, erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('user/login') . '/(r)/' . rawurlencode(base64_encode('form/downloaditem/' . $formCollected->id)), erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('user/login') . '/(r)/' . rawurlencode(base64_encode('form/viewcollected/' . $formCollected->id))), $sendMail->content); $emailRecipient = array(); if ($formCollected->form->recipient != '') { $emailRecipient = array($formCollected->form->recipient); } elseif ($sendMail->recipient != '') { $emailRecipient = array($sendMail->recipient); } if (!empty($emailRecipient)) { foreach ($emailRecipient as $receiver) { $mail->AddAddress($receiver); } self::setupSMTP($mail); if ($sendMail->bcc_recipients != '') { $recipientsBCC = explode(',', $sendMail->bcc_recipients); foreach ($recipientsBCC as $recipientBCC) { $mail->AddBCC(trim($recipientBCC)); } } $mail->Send(); $mail->ClearAddresses(); } }
" value="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/xmpp', 'Send test message'); ?> " /> <?php } ?> <ul class="button-group round"> <li><input type="submit" class="button small" name="StoreXMPGTalkSettings" value="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/buttons', 'Save'); ?> " /></li> <?php if (erLhcoreClassXMP::getAccessToken() !== false) { ?> <li><input type="submit" class="button small" name="StoreXMPGTalkRevokeToken" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/xmpp', 'Revoke access token'); ?> " value="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/xmpp', 'Revoke permission to send a message'); ?> " /></li> <?php } else { ?> <?php if (isset($xmp_data['gtalk_client_secret']) && !empty($xmp_data['gtalk_client_secret'])) { ?>
foreach ($form->xls_columns_data as $data) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, $data['name']); $i++; } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'Date')); $i++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, 'IP'); $i++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($i, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('form/index', 'Identifier')); // Set data $i = 2; foreach ($items as $item) { $y = 0; foreach ($form->xls_columns_data as $data) { if (isset($item->content_array[$data['attr_name']]['definition']['type']) && $item->content_array[$data['attr_name']]['definition']['type'] == 'file') { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($y, $i, erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('user/login') . '/(r)/' . rawurlencode(base64_encode('form/download/' . $item->id . '/' . $data['attr_name']))); } else { if (strpos($data['attr_name'], ',') === false) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($y, $i, $item->content_array[$data['attr_name']]['value']); } else { $nameParts = explode(',', $data['attr_name']); $valuesPart = array(); foreach ($nameParts as $part) { $valuesPart[] = isset($item->content_array[$part]['value']) ? $item->content_array[$part]['value'] : $part; } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($y, $i, implode('', $valuesPart)); } } $y++; } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($y, $i, $item->ctime_full_front);
public static function chatListExportXLS($chats, $params = array()) { include 'lib/core/lhform/PHPExcel.php'; $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp; $cacheSettings = array('memoryCacheSize ' => '64MB'); PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); $objPHPExcel = new PHPExcel(); $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->getStyle('A1:AW1')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->setTitle('Report'); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, "ID"); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Visitor Name')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'E-mail')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Phone')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Wait time')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Country')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'City')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'IP')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Operator')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Department')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Date')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Minutes')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(12, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Vote status')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(13, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Mail send')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(14, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Page')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(15, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Came from')); $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(16, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Link')); if (isset($params['type']) && $params['type'] == 2) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(17, 1, erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Chat content')); } $attributes = array('id', 'nick', 'email', 'phone', 'wait_time', 'country_name', 'city', 'ip', 'user', 'department'); $i = 2; foreach ($chats as $item) { foreach ($attributes as $key => $attr) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, (string) $item->{$attr}); } $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, date(erLhcoreClassModule::$dateFormat, $item->time)); $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, date('H:i:s', $item->time)); $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $item->fbst == 1 ? 'UP' : ($item->fbst == 2 ? 'DOWN' : 'NONE')); $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $item->mail_send == 1 ? 'Yes' : 'No'); $key++; if ($item->referrer != '') { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $item->referrer); } $key++; if ($item->session_referrer != '') { $referer = parse_url($item->session_referrer); if (isset($referer['host'])) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, $referer['host']); } } $key++; $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, "URL"); $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($key, $i)->getHyperlink()->setUrl(erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('user/login') . '/(r)/' . rawurlencode(base64_encode('chat/single/' . $item->id))); // Print chat content to last column if (isset($params['type']) && $params['type'] == 2) { $key++; $messages = erLhcoreClassModelmsg::getList(array('limit' => 10000, 'sort' => 'id ASC', 'filter' => array('chat_id' => $item->id))); $messagesContent = ''; foreach ($messages as $msg) { if ($msg->user_id == -1) { $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n"; } else { $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($item->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n"; } } $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, $i, trim($messagesContent)); } $i++; } $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); // We'll be outputting an excel file header('Content-type: application/vnd.ms-excel'); // It will be called file.xls header('Content-Disposition: attachment; filename="report.xlsx"'); // Write file to the browser $objWriter->save('php://output'); }
public static function newChatInformWorkflow($options = array(), &$chat) { $chat->nc_cb_executed = 1; $chat->updateThis(); if (in_array('mail', $options['options'])) { erLhcoreClassChatMail::sendMailUnacceptedChat($chat); } if (in_array('xmp', $options['options'])) { erLhcoreClassXMP::sendXMPMessage($chat); } erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.new_chat', array('chat' => &$chat)); // Execute callback if it exists $extensions = erConfigClassLhConfig::getInstance()->getSetting('site', 'extensions'); $instance = erLhcoreClassSystem::instance(); foreach ($extensions as $ext) { $callbackFile = $instance->SiteDir . '/extension/' . $ext . '/callbacks/new_chat.php'; if (file_exists($callbackFile)) { include $callbackFile; } } }
} if ($form->hasValidData('use_standard_xmp')) { $data['use_standard_xmp'] = $form->use_standard_xmp; } else { $data['use_standard_xmp'] = 0; } if ($form->hasValidData('test_recipients')) { $data['test_recipients'] = $form->test_recipients; } else { $data['test_recipients'] = ''; } if ($form->hasValidData('test_group_recipients')) { $data['test_group_recipients'] = $form->test_group_recipients; } else { $data['test_group_recipients'] = ''; } $xmpData->value = serialize($data); $xmpData->saveThis(); if (isset($_POST['StoreXMPSettingsTest'])) { try { erLhcoreClassXMP::sendTestXMP($currentUser->getUserData()); $tpl->set('message_send', 'done'); } catch (Exception $e) { $tpl->set('errors', array($e->getMessage())); } } $tpl->set('updated', 'done'); } $tpl->set('xmp_data', $data); $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'System configuration')), array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('system/xmpp', 'XMPP settings')));
public static function chatListExportXLS($chats, $params = array()) { include 'lib/core/lhform/PHPExcel.php'; $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp; $cacheSettings = array('memoryCacheSize ' => '64MB'); PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); $chatArray = array(); $id = "ID"; $name = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Visitor Name'); $email = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'E-mail'); $phone = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Phone'); $wait = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Wait time'); $country = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Country'); $city = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'City'); $ip = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'IP'); $operator = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Operator'); $dept = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Department'); $date = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Date'); $minutes = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Minutes'); $vote = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Vote status'); $mail = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Mail send'); $page = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Page'); $from = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Came from'); $link = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Link'); if (isset($params['type']) && $params['type'] == 2) { $content = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatexport', 'Chat content'); } else { $content = null; } $chatArray[] = array($id, $name, $email, $phone, $wait, $country, $city, $ip, $operator, $dept, $date, $minutes, $vote, $mail, $page, $from, $link, $content); foreach ($chats as $item) { $id = (string) $item->{'id'}; $nick = (string) $item->{'nick'}; $email = (string) $item->{'email'}; $phone = (string) $item->{'phone'}; $wait = (string) $item->{'wait_time'}; $country = (string) $item->{'country_name'}; $city = (string) $item->{'city'}; $ip = (string) $item->{'ip'}; $user = (string) $item->{'user'}; $dept = (string) $item->{'department'}; $date = date(erLhcoreClassModule::$dateFormat, $item->time); $minutes = date('H:i:s', $item->time); $vote = $item->fbst == 1 ? 'UP' : ($item->fbst == 2 ? 'DOWN' : 'NONE'); $mail = $item->mail_send == 1 ? 'Yes' : 'No'; $page = $item->referrer; if ($item->session_referrer != '') { $referer = parse_url($item->session_referrer); if (isset($referer['host'])) { $from = $referer['host']; } else { $from = null; } } else { $from = null; } $url = erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('user/login') . '/(r)/' . rawurlencode(base64_encode('chat/single/' . $item->id)); // Print chat content to last column if (isset($params['type']) && $params['type'] == 2) { $messages = erLhcoreClassModelmsg::getList(array('limit' => 10000, 'sort' => 'id ASC', 'filter' => array('chat_id' => $item->id))); $messagesContent = ''; foreach ($messages as $msg) { if ($msg->user_id == -1) { $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmin', 'System assistant') . ': ' . htmlspecialchars($msg->msg) . "\n"; } else { $messagesContent .= date(erLhcoreClassModule::$dateDateHourFormat, $msg->time) . ' ' . ($msg->user_id == 0 ? htmlspecialchars($item->nick) : htmlspecialchars($msg->name_support)) . ': ' . htmlspecialchars($msg->msg) . "\n"; } } $chatArray[] = array($id, $nick, $email, $phone, $wait, $country, $city, $ip, $user, $dept, $date, $minutes, $vote, $mail, $page, $from, $url, trim($messagesContent)); } else { $chatArray[] = array($id, $nick, $email, $phone, $wait, $country, $city, $ip, $user, $dept, $date, $minutes, $vote, $mail, $page, $from, $url); } } // Create new PHPExcel object $objPHPExcel = new PHPExcel(); $objPHPExcel->setActiveSheetIndex(0); // Set the starting point and array of data $objPHPExcel->getActiveSheet()->fromArray($chatArray, null, 'A1'); // Set style for top row $objPHPExcel->getActiveSheet()->getStyle('A1:AW1')->getFont()->setBold(true); // Set file type and name of file header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="report.xlsx"'); header('Cache-Control: max-age=0'); $writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $writer->save('php://output'); }
" class="button small radius"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('form/collected', 'Download XLS'); ?> </a></div> <div class="columns large-6"> <div class="row collapse"> <div class="small-2 columns"> <span class="prefix"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('form/collected', 'URL'); ?> </span> </div> <div class="small-10 columns"> <input type="text" value="<?php echo erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST']; echo erLhcoreClassDesign::baseurldirect('form/fill'); ?> /<?php echo $form->id; ?> "> </div> </div> </div> </div> <table class="twelve" cellpadding="0" cellspacing="0"> <thead> <tr>
public static function _make_url_mail_file($matches) { if (isset($matches[1])) { list($fileID, $hash) = explode('_', $matches[1]); try { $file = erLhcoreClassModelChatFile::fetch($fileID); // Check that user has permission to see the chat. Let say if user purposely types file bbcode if ($hash == md5($file->name . '_' . $file->chat_id)) { return erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('file/downloadfile') . "/{$file->id}/{$hash}"; } } catch (Exception $e) { } return ''; } return ''; }