Exemple #1
0
 private function newMessage($phone, $fname, $lname, $message, $context)
 {
     $host = Tools::getHttpHost();
     // insert to DB
     $query = "insert into " . _DB_PREFIX_ . egcallme::INSTALL_SQL_BD1NAME . " \n        (`id_shop`, `host`, `type`, `phone`, `fname`,`lname`, `message`) \n        values ('" . (int) $context->shop->id . "', '" . $host . "', 'callback', '" . $phone . "',\n            '" . $fname . "','" . $lname . "', '" . $message . "')";
     Db::getInstance()->execute(trim($query));
     // notify by email
     $emails_param = Configuration::get('EGCALLME_EMAIL_NOTIFY');
     if (trim($emails_param) != "") {
         $param = array('{phone}' => $phone, '{message}' => $message, '{fname}' => $fname, '{lname}' => $lname, '{host}' => $host);
         $emails = explode(';', $emails_param);
         $dir = egcallme::getModuleDir() . '/mails/';
         foreach ($emails as $email) {
             $email_theme = "email_notify";
             Mail::Send((int) $context->language->id, $email_theme, Mail::l("NEW Callback " . $phone, $this->context->language->id), $param, trim($email), "", null, null, null, null, $dir, false, (int) $context->shop->id);
         }
         $param['{phone}'] = preg_replace('#\\D+#', '', $param['{phone}']);
         $requests = Configuration::getMultiple(array('EGCALLME_HTTPNOT_1', 'EGCALLME_HTTPNOT_2', 'EGCALLME_HTTPNOT_3'));
         $texts = Configuration::getMultiple(array('EGCALLME_HTTPNOT_1_TXT', 'EGCALLME_HTTPNOT_2_TXT', 'EGCALLME_HTTPNOT_3_TXT'));
         foreach ($requests as $key => $request) {
             $request = $this->replaceKeywords($param, $request, $texts[$key . '_TXT']);
             $result = file_get_contents($request);
         }
     }
 }
Exemple #2
0
 public function hookDisplayNav($params)
 {
     $this->smarty->assign(array('btn_view' => Configuration::get('EGCALLME_BTN_VIEW'), 'phone' => $this->getSitePhone(), 'phone_tube' => Configuration::get('EGCALLME_PHONE_TUBE'), 'btn_self' => Configuration::get('EGCALLME_BTN_SELF'), 'mask' => Configuration::get('EGCALLME_PHONE_MASK'), 'phone_color' => str_replace("#", "", Configuration::get('EGCALLME_PHONE_TUBE_C')), 'ajaxcontroller' => $this->context->link->getModuleLink($this->name, 'ajax'), 'rgb' => egcallme::hex2rgb(Configuration::get('EGCALLME_PHONE_TUBE_C'))));
     return $this->display(__FILE__, 'main_hook.tpl');
 }