= 2) { $current_page = substr($current_page, $substr_pos); } } // Get the current host from the request data $current_host = $_REQUEST['URL']; $str_start = 0; for ($i = 0; $i < 3; $i++) { $substr_pos = strpos($current_host, '/'); if ($substr_pos === false) { break; } if ($i < 2) { $current_host = substr($current_host, $substr_pos + 1); $str_start += $substr_pos + 1; } elseif ($i >= 2) { $current_host = substr($_REQUEST['URL'], 0, $substr_pos + $str_start); } } // Deparment disable $disable_department = $departments; // Joomla Auto Login $query = "SELECT visitor_name , visitor_email FROM " . $table_prefix . "requests WHERE id = " . ( (int) $request_id ); $row = $SQL->selectquery($query); if (is_array($row)) { if ($row['visitor_name'] != '') { $username = $row['visitor_name']; $email = $row['visitor_email']; $autologin =TRUE; // Count available departments $query = "SELECT DISTINCT u.department FROM " . $table_prefix . "users u, " . $table_prefix . "domain_user du WHERE (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(u.refresh)) < '$connection_timeout' and u.status = '1' and u.id = du.id_user And du.id_domain = " . $domain_id; $rows = $SQL->selectall($query); if (is_array($rows)) { $dep_num = count($rows); } } } // User Recognition Auto Start if ($disable_login_details == false && $autologin == true && $dep_num ==1 ) { header('Location: ' . $install_directory . '/frames.php?URL=' . urlencode( $_REQUEST['URL'] ) . '&SERVER=' . $_REQUEST['SERVER'].'&DOMAINID='.$domain_id .'&USER='.$username .'&EMAIL='.$email .'&AGENTID='.$agent_id.'&LANGUAGE='.LANGUAGE_TYPE); exit(); } // Update the current URL statistics within the requests tables if ($current_page == '') { $current_page = '/'; } $query = "SELECT `path` FROM " . $table_prefix . "requests WHERE `id` = '" . ( (int) $request_id ) . "'"; $row = $SQL->selectquery($query); if (is_array($row)) { $current_page = urldecode($current_page); $prev_path = explode('; ', $row['path']); $current_path = $row['path']; end($prev_path); $index = key($prev_path); if ($current_page != $prev_path[$index]) { $query = "UPDATE " . $table_prefix . "requests SET `url` = '$current_page', `title` = '$title', `path` = '$current_path; $current_page', number_pages = number_pages + 1 WHERE `id` = '$request_id'"; $SQL->insertquery($query); } } if (!isset($_COOKIE[$cookieName])) { //TODO - Revisar este codigo debe mejorarse cuando el usuario va directamente al archivo index.php header('Location: ' . $install_directory . '/cookies.php?SERVER=' . $_REQUEST['SERVER'] . '&COOKIE=true'.'&DOMAINID='.$domain_id); exit(); } // Checks if any users in user table are online if ($error == '') { $query = "SELECT u.id FROM " . $table_prefix . "users u, " . $table_prefix . "domain_user du WHERE (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(u.refresh)) < '$connection_timeout' AND u.status = '1' And du.id_user = u.id And du.id_domain = ".$domain_id; if ($department != '' && $departments == true && $agent_id ==0) { $query .= " and `answers`=1 and department LIKE '%$department%'"; } else if ($agent_id ==0) { $query .= " and `answers`=1 "; } else if ( $agent_id !=0) { $query .= " and `answers`=2 and u.id=" .$agent_id; } $row = $SQL->selectquery($query); if(!is_array($row)) { header('Location: ' . $install_directory . '/offline.php?DOMAINID='.$domain_id.'&SERVER='.$_REQUEST['SERVER'].'&URL='. urlencode( $_REQUEST['URL'] ) .'&LANGUAGE='.LANGUAGE_TYPE); exit(); } } if ($disable_login_details == true) { header('Location: ' . $install_directory . '/frames.php?URL=' . urlencode( $_REQUEST['URL'] ) . '&SERVER=' . $_REQUEST['SERVER'].'&DOMAINID='.$domain_id. '&AGENTID='.$agent_id. '&LANGUAGE='.LANGUAGE_TYPE); exit(); } //invalidating old 'GUEST_LOGIN_ID' to create a new session for the chat if (isset($_COOKIE[$cookieName])) { $session = array(); $session = unserialize($_COOKIE[$cookieName]); $session['GUEST_LOGIN_ID'] = "0"; $data = serialize($session); setCookie($cookieName, $data, false, '/', $cookie_domain, $ssl); header("P3P: CP='$p3p'"); /* foreach ($session as $key => $value) { } */ unset($session); } } header('Content-type: text/html; charset=' . CHARSET); $language_file = './i18n/' . LANGUAGE_TYPE . '/lang_guest_' . LANGUAGE_TYPE . '.php'; if (file_exists($language_file)) { include($language_file); } else { include('./i18n/en/lang_guest_en.php'); } include_once('import/settings_default.php'); ?> <?php echo($livehelp_name); ?> selectall($query); if(is_array($rows)) { foreach ($rows as $key => $row) { if (is_array($row)) { $setting = $row['name']; if($setting == "disable_language") { $disable_language = $row['value']; } elseif($setting == "phone") { $use_phone = $row['value']; } else { $use_company = $row['value']; } } } } ?>
selcount($query); /* $disable_language =0; // find the custom form link $query = "SELECT `value` FROM " . $table_prefix . "settings WHERE `id_domain`= '$domain_id' and name ='disable_language'"; $row = $SQL->selectquery($query); if (is_array($row)) { $disable_language = $row['value']; } */ ?> 1 && $disable_language ==0) { ?> selectquery($query); if (is_array($row)) { $copyright = $row['value']; } if ($copyright ==1) { $query = "SELECT value FROM " . $table_prefix . "settings WHERE name = 'company_logo' and id_domain = $domain_id"; $row = $SQL->selectquery($query); if (is_array($row)) { $logo = $row['value']; } $query = "SELECT value FROM " . $table_prefix . "settings WHERE name = 'company_link' and id_domain = $domain_id"; $row = $SQL->selectquery($query); if (is_array($row)) { $company_link = $row['value']; } $query = "SELECT value FROM " . $table_prefix . "settings WHERE name = 'company_slogan' and id_domain = $domain_id"; $row = $SQL->selectquery($query); if (is_array($row)) { $company_slogan = $row['value']; } $query = "SELECT value FROM " . $table_prefix . "settings WHERE name = 'copyright_image' and id_domain = $domain_id"; $row = $SQL->selectquery($query); if (is_array($row)) { $banner_enable = $row['value']; } $livehelp_logo_path = $install_directory . '/domains/' . $domain_id . '/i18n/en/pictures/'; ?>