} /** * Nhan thong tin va gui den admin */ if ($nv_Request->isset_request('checkss', 'post')) { $checkss = $nv_Request->get_title('checkss', 'post', ''); if ($checkss != NV_CHECK_SESSION) { die; } /** * Ajax */ if ($nv_Request->isset_request('loadForm', 'post')) { $array_content = array('fname' => $fname, 'femail' => $femail, 'fphone' => $fphone); $base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name; $form = contact_form_theme($array_content, $catsName, $base_url, NV_CHECK_SESSION); exit($form); } if (!defined('NV_IS_USER')) { $fname = nv_substr($nv_Request->get_title('fname', 'post', '', 1), 0, 100); $femail = nv_substr($nv_Request->get_title('femail', 'post', '', 1), 0, 100); } if (empty($fname)) { die(json_encode(array('status' => 'error', 'input' => 'fname', 'mess' => $lang_module['error_fullname']))); } if (($check_valid_email = nv_check_valid_email($femail)) != '') { die(json_encode(array('status' => 'error', 'input' => 'femail', 'mess' => $check_valid_email))); } if (($ftitle = nv_substr($nv_Request->get_title('ftitle', 'post', '', 1), 0, 255)) == '') { die(json_encode(array('status' => 'error', 'input' => 'ftitle', 'mess' => $lang_module['error_title']))); }
/** * main_theme() * * @param mixed $array_content * @param mixed $array_department * @param mixed $base_url * @param mixed $checkss * @return */ function contact_main_theme($array_content, $array_department, $catsName, $base_url, $checkss) { global $module_file, $lang_global, $lang_module, $module_info; $xtpl = new XTemplate('main.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file); $xtpl->assign('LANG', $lang_module); $xtpl->assign('GLANG', $lang_global); $xtpl->assign('CHECKSS', $checkss); $xtpl->assign('CONTENT', $array_content); if (!empty($array_content['bodytext'])) { $xtpl->parse('main.bodytext'); } if (!empty($array_department)) { foreach ($array_department as $dep) { $xtpl->assign('DEP', $dep); if (!empty($dep['note'])) { $xtpl->parse('main.dep.note'); } if (!empty($dep['phone'])) { $nums = array_map("trim", explode("|", nv_unhtmlspecialchars($dep['phone']))); foreach ($nums as $k => $num) { unset($m); if (preg_match("/^(.*)\\s*\\[([0-9\\+\\.\\,\\;\\*\\#]+)\\]\$/", $num, $m)) { $phone = array('number' => nv_htmlspecialchars($m[1]), 'href' => $m[2]); $xtpl->assign('PHONE', $phone); $xtpl->parse('main.dep.phone.item.href'); $xtpl->parse('main.dep.phone.item.href2'); } else { $num = preg_replace("/\\[[^\\]]*\\]/", "", $num); $phone = array('number' => nv_htmlspecialchars($num)); $xtpl->assign('PHONE', $phone); } if ($k) { $xtpl->parse('main.dep.phone.item.comma'); } $xtpl->parse('main.dep.phone.item'); } $xtpl->parse('main.dep.phone'); } if (!empty($dep['fax'])) { $xtpl->parse('main.dep.fax'); } if (!empty($dep['email'])) { $emails = array_map("trim", explode(",", $dep['email'])); foreach ($emails as $k => $email) { $xtpl->assign('EMAIL', $email); if ($k) { $xtpl->parse('main.dep.email.item.comma'); } $xtpl->parse('main.dep.email.item'); } $xtpl->parse('main.dep.email'); } if (!empty($dep['others'])) { $others = json_decode($dep['others'], true); if (!empty($others)) { foreach ($others as $key => $value) { if (!empty($value)) { if (strtolower($key) == "yahoo") { $ys = array_map("trim", explode(",", $value)); foreach ($ys as $k => $y) { $xtpl->assign('YAHOO', array('name' => $key, 'value' => $y)); if ($k) { $xtpl->parse('main.dep.yahoo.item.comma'); } $xtpl->parse('main.dep.yahoo.item'); } $xtpl->parse('main.dep.yahoo'); } elseif (strtolower($key) == "skype") { $ss = array_map("trim", explode(",", $value)); foreach ($ss as $k => $s) { $xtpl->assign('SKYPE', array('name' => $key, 'value' => $s)); if ($k) { $xtpl->parse('main.dep.skype.item.comma'); } $xtpl->parse('main.dep.skype.item'); } $xtpl->parse('main.dep.skype'); } elseif (strtolower($key) == "viber") { $ss = array_map("trim", explode(",", $value)); foreach ($ss as $k => $s) { $xtpl->assign('VIBER', array('name' => $key, 'value' => $s)); if ($k) { $xtpl->parse('main.dep.viber.item.comma'); } $xtpl->parse('main.dep.viber.item'); } $xtpl->parse('main.dep.viber'); } elseif (strtolower($key) == "icq") { $ss = array_map("trim", explode(",", $value)); foreach ($ss as $k => $s) { $xtpl->assign('ICQ', array('name' => $key, 'value' => $s)); if ($k) { $xtpl->parse('main.dep.icq.item.comma'); } $xtpl->parse('main.dep.icq.item'); } $xtpl->parse('main.dep.icq'); } elseif (strtolower($key) == "whatsapp") { $ss = array_map("trim", explode(",", $value)); foreach ($ss as $k => $s) { $xtpl->assign('WHATSAPP', array('name' => $key, 'value' => $s)); if ($k) { $xtpl->parse('main.dep.whatsapp.item.comma'); } $xtpl->parse('main.dep.whatsapp.item'); } $xtpl->parse('main.dep.whatsapp'); } else { $xtpl->assign('OTHER', array('name' => $key, 'value' => $value)); $xtpl->parse('main.dep.other'); } } } } } $xtpl->parse('main.dep'); } } $form = contact_form_theme($array_content, $catsName, $base_url, $checkss); $xtpl->assign('FORM', $form); $xtpl->parse('main'); return $xtpl->text('main'); }
/** * Nhan thong tin va gui den admin */ if ($nv_Request->isset_request('checkss', 'post')) { $checkss = $nv_Request->get_title('checkss', 'post', ''); if ($checkss != md5($client_info['session_id'] . $global_config['sitekey'])) { die; } /** * Ajax */ if ($nv_Request->isset_request('loadForm', 'post')) { $array_content = array('fname' => $fname, 'femail' => $femail, 'fphone' => $fphone); $checkss = md5($client_info['session_id'] . $global_config['sitekey']); $base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name; $form = contact_form_theme($array_content, $catsName, $base_url, $checkss); exit($form); } if (!defined('NV_IS_USER')) { $fname = nv_substr($nv_Request->get_title('fname', 'post', '', 1), 0, 100); $femail = nv_substr($nv_Request->get_title('femail', 'post', '', 1), 0, 100); } if (empty($fname)) { die(json_encode(array('status' => 'error', 'input' => 'fname', 'mess' => $lang_module['error_fullname']))); } if (($check_valid_email = nv_check_valid_email($femail)) != '') { die(json_encode(array('status' => 'error', 'input' => 'femail', 'mess' => $check_valid_email))); } if (($ftitle = nv_substr($nv_Request->get_title('ftitle', 'post', '', 1), 0, 255)) == '') { die(json_encode(array('status' => 'error', 'input' => 'ftitle', 'mess' => $lang_module['error_title']))); }