public function deleteDepartment($id) { $dl = MapperFactory::getMapper('DepartmentLocale')->getDepartmentLocale($id, $locale); MapperFactory::getMapper('Department')->delete($dl['departmentlocaleid']); MapperFactory::getMapper('DepartmentLocale')->delete($id); $od = MapperFactory::getMapper('OperatorDepartment')->deleteDepartment($id); }
public static function getParameters($lang = NULL) { if ($lang === NULL) { $lang = Resources::getCurrentLocale(); } $themes = enumAvailableThemes(); $images = Button::enumAvailableImages($lang); $departments = MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale()); $departmentsParam = array(array('key' => '', 'value' => Resources::Get('page.gen.anydepartment'))); foreach ($departments as $d) { $item = array(); $item['key'] = $d['departmentkey']; $item['value'] = $d['departmentname']; $departmentsParam[] = $item; } $locales = getAvailableLocalesForChat(); $localesParam = array(array('key' => 'N', 'value' => Resources::Get('page.gen.autolocale'))); // $localesParam = array(); foreach ($locales as $l) { $item = array(); $item['key'] = $l['localeid']; $item['value'] = $l['localename']; $localesParam[] = $item; } $params = array("button" => array("name_key" => 'page.gen.choose_image', "type" => "list", "values" => Button::listToArray($images), "default" => "webim"), "theme" => array("name_key" => 'page.gen.choose_theme', "type" => "list", "values" => Button::listToArray($themes), "default" => "default"), "include_host_url" => array("name_key" => 'page.gen.include_site_name', "type" => "checkbox", "default" => "N"), "secure" => array("name_key" => 'page.gen.secure_links', "type" => "checkbox", "default" => "N"), "add_track_code" => array("name_key" => 'page.gen.include_tracker_code', "type" => "checkbox", "default" => "N"), "choose_department" => array("name_key" => 'page.gen.choosedepartment', "type" => "checkbox", "default" => "N"), "department_key" => array("name_key" => 'page.gen.department', "type" => "list", "values" => $departmentsParam, "default" => ""), "choose_operator" => array("name_key" => 'page.gen.chooseoperator', "type" => "list", "values" => array(array('key' => 'N', 'value' => Resources::Get('choose_operator.no')), array('key' => 'optional', 'value' => Resources::Get('choose_operator.optional')), array('key' => 'mandatory', 'value' => Resources::Get('choose_operator.mandatory'))), "default" => "N"), "chat_immediately" => array("name_key" => 'page.gen.chatimmediately', "type" => "checkbox", "default" => "N"), "locale" => array("name_key" => 'page.gen.locale', "type" => "list", "values" => $localesParam, "default" => Resources::getCurrentLocale())); return $params; }
public static function getParameters($lang = null) { if ($lang === null) { $lang = Resources::getCurrentLocale(); } $themes = enumAvailableThemes(); $images = self::enumAvailableImages($lang); $departments = MapperFactory::getMapper('Department')->enumDepartments(Resources::getCurrentLocale()); $departmentsParam = array(array('key' => '', 'value' => Resources::Get('page.gen.anydepartment'))); foreach ($departments as $d) { $item = array(); $item['key'] = $d['departmentkey']; $item['value'] = $d['departmentname']; $departmentsParam[] = $item; } $locales = getAvailableLocalesForChat(); $localesParam = array(array('key' => 'N', 'value' => Resources::Get('page.gen.autolocale'))); // $localesParam = array(); foreach ($locales as $l) { $item = array(); $item['key'] = $l['localeid']; $item['value'] = $l['localename']; $localesParam[] = $item; } $params = array('button' => array('name_key' => 'page.gen.choose_image', 'type' => 'list', 'values' => self::listToArray($images), 'default' => 'webim'), 'theme' => array('name_key' => 'page.gen.choose_theme', 'type' => 'list', 'values' => self::listToArray($themes), 'default' => 'default'), 'include_host_url' => array('name_key' => 'page.gen.include_site_name', 'type' => 'checkbox', 'default' => 'N'), 'secure' => array('name_key' => 'page.gen.secure_links', 'type' => 'checkbox', 'default' => 'N'), 'add_track_code' => array('name_key' => 'page.gen.include_tracker_code', 'type' => 'checkbox', 'default' => 'N'), 'choose_department' => array('name_key' => 'page.gen.choosedepartment', 'type' => 'checkbox', 'default' => 'N'), 'department_key' => array('name_key' => 'page.gen.department', 'type' => 'list', 'values' => $departmentsParam, 'default' => ''), 'choose_operator' => array('name_key' => 'page.gen.chooseoperator', 'type' => 'list', 'values' => array(array('key' => 'N', 'value' => Resources::Get('choose_operator.no')), array('key' => 'optional', 'value' => Resources::Get('choose_operator.optional')), array('key' => 'mandatory', 'value' => Resources::Get('choose_operator.mandatory'))), 'default' => 'N'), 'chat_immediately' => array('name_key' => 'page.gen.chatimmediately', 'type' => 'checkbox', 'default' => 'N'), 'locale' => array('name_key' => 'page.gen.locale', 'type' => 'list', 'values' => $localesParam, 'default' => Resources::getCurrentLocale())); return $params; }
/** * @param \GoogleAnalyticsTracker\Customizations\Common\Customizable $customizable * @return array */ public function map($customizable) { if (!$customizable instanceof \GoogleAnalyticsTracker\Customizations\Common\Customizable) { throw new \UnexpectedValueException("The Customizable Mapper only accepts Customizable HitTypes"); } $data = array(); $customDimensions = $customizable->getCustomDimensions(); if (!empty($customDimensions)) { foreach ($customizable->getCustomDimensions() as $customDimension) { if (!isset($customDimensionsMapper)) { $customDimensionsMapper = MapperFactory::getMapper($customDimension); } list($k, $v) = $customDimensionsMapper->map($customDimension); $data[$k] = $v; } } $customMetrics = $customizable->getCustomMetrics(); if (!empty($customMetrics)) { foreach ($customizable->getCustomMetrics() as $customMetric) { if (!isset($customMetricsMapper)) { $customMetricsMapper = MapperFactory::getMapper($customMetric); } list($k, $v) = $customMetricsMapper->map($customMetric); $data[$k] = $v; } } return $data; }
public function getEmail($threadid = false) { if (!$threadid) { return ''; } $firstMessage = MapperFactory::getMapper('Message')->getFirstMessage($threadid); if (sizeof($firstMessage) == 0) { return ''; } preg_match("/mail:.*?(\\S*?@\\S*?\\.\\S*)/mix", $firstMessage['message'], $find); if ($find[1]) { return $find[1]; } return ''; }
public function sendAutoIniviteTextToOperator($thread, $autoinviteid) { $ainvite = MapperFactory::getMapper("AutoInvite")->getById($autoinviteid); if (empty($ainvite)) { return; } $message = Resources::Get("chat.window.auto_invite_text", array($ainvite['text'])); Thread::getInstance()->PostMessage($thread['threadid'], KIND_FOR_AGENT, $message); }
function inviteSubmitted() { global $TITLE_KEY; $TML = new SmartyClass($TITLE_KEY); $isNew = empty($_REQUEST['autoinviteid']); $toCheck = array('text' => 'form.field.text'); foreach ($toCheck as $field => $res) { if (empty($_REQUEST[$field])) { $errors[] = Resources::Get("errors.required", array(Resources::Get($res))); } } if (!isset($_REQUEST['number_of_pages']) || !empty($_REQUEST['number_of_pages']) && !is_numeric($_REQUEST['number_of_pages'])) { $errors[] = Resources::Get("errors.not_numeric.number_of_pages"); } if (!isset($_REQUEST['time_on_site']) || !is_numeric($_REQUEST['time_on_site'])) { $errors[] = Resources::Get("errors.not_numeric.time_on_site"); } $visited_pages = array(); if (isset($_REQUEST['visited_page']) && is_array($_REQUEST['visited_page']) && isset($_REQUEST['visited_page_time']) && is_array($_REQUEST['visited_page_time'])) { foreach ($_REQUEST['visited_page'] as $k => $v) { if (!empty($v)) { if (!isset($_REQUEST['visited_page_time'][$k]) || !is_numeric($_REQUEST['visited_page_time'][$k])) { $errors[] = Resources::Get("errors.not_numeric.visited_page_time"); } else { array_push($visited_pages, array("url" => $v, "time" => $_REQUEST['visited_page_time'][$k])); } } } } $hash = array(); if (empty($errors)) { $hash['text'] = $_REQUEST['text']; $hash['conditions'] = array(); if (isset($_REQUEST['came_from']) && !empty($_REQUEST['came_from'])) { $hash['conditions']['came_from'] = $_REQUEST['came_from']; } if (isset($_REQUEST['number_of_pages']) && !empty($_REQUEST['number_of_pages'])) { $hash['conditions']['number_of_pages'] = $_REQUEST['number_of_pages']; } if (isset($_REQUEST['time_on_site']) && !empty($_REQUEST['time_on_site'])) { $hash['conditions']['time_on_site'] = $_REQUEST['time_on_site']; } if (isset($_REQUEST['order_matters']) && !empty($_REQUEST['order_matters'])) { $hash['conditions']['order_matters'] = 1; } if (count($visited_pages) > 0) { $hash['conditions']['visited_pages'] = $visited_pages; } $json = new Json(); $hash['conditions'] = $json->encode($hash['conditions']); if ($isNew) { $autoinviteToUpdateId = MapperFactory::getMapper("AutoInvite")->save($hash); } else { $autoinviteToUpdateId = $_REQUEST['autoinviteid']; $hash['autoinviteid'] = $autoinviteToUpdateId; MapperFactory::getMapper("AutoInvite")->save($hash); } header("Location: " . AdminURL::getInstance()->getURL('auto_invites')); exit; } foreach (array('order_matters', 'text', 'came_from', 'visited_page', 'visited_page_time', 'time_on_site', 'number_of_pages') as $f) { if (isset($_REQUEST[$f]) && !empty($_REQUEST[$f])) { $TML->assign($f, $_REQUEST[$f]); } } $TML->assign('errors', $errors); $TML->display('auto_invite.tpl'); }
function tryToGetExistingThread() { $threadid = verify_param('thread', "/^\\d{1,8}\$/", ''); $thread = null; if (empty($threadid)) { $visitor = GetVisitorFromRequestAndSetCookie(); $thread = MapperFactory::getMapper('Thread')->getActiveThreadForVisitor($visitor['id']); } else { $thread = Thread::getInstance()->GetThreadById($threadid); $token = verify_param('token', "/^\\d{1,8}\$/"); if ($token != $thread['token'] || $thread['state'] == STATE_CLOSED) { $thread = null; } } if (!empty($thread) && (visitorHasAccess($thread) || empty($threadid))) { ThreadProcessor::getInstance()->ProcessThread($thread['threadid'], 'ping_visitor'); $thread = Thread::getInstance()->GetThreadById($thread['threadid']); if (empty($thread) || $thread['state'] == STATE_CLOSED) { $thread = null; } } else { $thread = null; } return $thread; }
public function getListThreadsCount($currentoperatorid, $q, $show_empty = true, $checkDepartmentsAccess = true, $start_date = null, $end_date = null, $operatorid = null, $departmentid = null, $locale = null, $rate = null, $offline = null) { $departmentsExist = count(MapperFactory::getMapper('Department')->enumDepartments(Resources::getCurrentLocale())); // TODO probably not the best place $query_params = array(); $sWhere = ''; $nTotal = 0; $sCountSql = 'SELECT COUNT(*) AS cnt FROM {thread} as t LEFT JOIN {visitsession} as v ON v.visitsessionid = t.visitsessionid WHERE 1'; if (!empty($q)) { $query_params['query'] = "%%{$q}%%"; $sWhere .= ' AND (t.threadid IN ( SELECT threadid FROM {message} as m WHERE m.sendername LIKE :query OR m.message LIKE :query ) OR v.visitorid LIKE :query OR v.ip LIKE :query OR v.remotehost LIKE :query OR t.operatorfullname LIKE :query )'; } if (!empty($rate)) { $sign = $rate == 'positive' ? '>' : '<'; $sWhere .= " AND EXISTS (SELECT * FROM {rate} r WHERE r.threadid=t.threadid AND r.rate {$sign} 0 AND r.deldate IS NULL) "; } if ($checkDepartmentsAccess) { $sWhere .= ' AND (t.departmentid IS NULL OR EXISTS(SELECT * FROM {operatordepartment} od WHERE od.operatorid=:currentoperatorid AND od.departmentid=t.departmentid)) '; $query_params['currentoperatorid'] = $currentoperatorid; } if (!$show_empty) { $sWhere .= ' AND t.visitormessagecount > 0 '; } if ($start_date !== null) { $query_params['start_date'] = $start_date; $sWhere .= ' AND unix_timestamp(t.created) >= :start_date'; } if ($end_date !== null) { $query_params['end_date'] = $end_date; $sWhere .= ' AND unix_timestamp(t.created) < :end_date'; } if ($operatorid !== null) { $query_params['operatorid'] = $operatorid; $sWhere .= ' AND (:operatorid IS NULL OR t.operatorid=:operatorid)'; } if (!empty($departmentid)) { $query_params['departmentid'] = $departmentid; $sWhere .= ' AND t.departmentid = :departmentid '; } if (!empty($locale)) { $query_params['locale'] = $locale; $sWhere .= ' AND t.locale = :locale '; } if ($offline !== null) { $query_params['offline'] = $offline; $sWhere .= ' AND t.offline=:offline'; } $sCountSql .= $sWhere; try { $this->db->query($sCountSql, $query_params); $this->db->nextRecord(); $nTotal = $this->db->getRow('cnt'); } catch (Exception $e) { return 0; } return $nTotal; }
private static function formatStatistics($start, $end) { $result = ''; $report = MapperFactory::getMapper('Thread')->getReportByDate($start, $end); if (count($report) == 0) { $report = array(array(date(getDateFormat(), $start), 0, 0, 0)); } if (count($report) > 1) { $report_total = MapperFactory::getMapper('Thread')->getReportTotalByDate($start, $end); $report_total = array_values($report_total); array_unshift($report_total, Resources::Get('report.total')); $report[] = $report_total; unset($report_total); } $result .= Resources::Get('report.bydate.title') . "\n"; $result .= self::formatTable(array(Resources::Get('report.bydate.1'), Resources::Get('report.bydate.2'), Resources::Get('report.bydate.3'), Resources::Get('report.bydate.4')), $report, self::FIELD_LENGTH) . "\n\n"; $report = MapperFactory::getMapper('Operator')->getAdvancedReportByDate($start, $end); $result .= Resources::Get('report.byoperator_date.title') . "\n"; $result .= Resources::Get('report.no_items'); $dates_count = count($report); if (count($report) > 0) { $header = array(Resources::Get('report.byoperator.1'), Resources::Get('report.byoperator.2'), Resources::Get('report.byoperator.3'), Resources::Get('report.byoperator.6'), Resources::Get('report.byoperator.7'), Resources::Get('report.byoperator.11')); $field_count = count($header); $length_chars = $field_count * self::FIELD_LENGTH + $field_count; $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n"; $result .= self::formatTableLine($header, self::FIELD_LENGTH) . "\n"; $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n"; $middle = floor($length_chars / 2); foreach ($report as $d => $r) { if ($dates_count > 1) { $result .= sprintf('%' . ($middle + strlen($d)) . 's', $d) . "\n"; $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n"; } foreach ($r as $v) { $v = array($v['name'], $v['threads'], isset($v['messages']) ? $v['messages'] : '', $v['online_time'], $v['online_chatting_time'], $v['invited_users']); $result .= self::formatTableLine($v, self::FIELD_LENGTH) . "\n"; $result .= self::makeBorder($field_count, self::FIELD_LENGTH) . "\n"; } } } $result .= "\n\n"; if ($dates_count > 1) { $report = Thread::getInstance()->GetReportByAgent($start, $end); $data = array(); foreach ($report as $v) { $data[] = array($v['name'], $v['threads'], $v['messages'], $v['online_time'], $v['online_chatting_time'], $v['invited_users']); } $result .= Resources::Get('report.byoperator.title') . "\n"; $result .= self::formatTable($header, $data, self::FIELD_LENGTH) . "\n\n"; } $result .= Resources::Get('report.lostvisitors.title') . "\n"; $report = MapperFactory::getMapper('LostVisitor')->getReportByOperator($start, $end); $data = array(); $header = array(Resources::Get('report.lostvisitors.1'), Resources::Get('report.lostvisitors.2'), Resources::Get('report.lostvisitors.3')); if (!empty($report)) { foreach ($report as $v) { $data[] = array($v['name'], isset($v['lost_vistors_count']) ? $v['lost_vistors_count'] : 0, isset($v['avg_waittime_str']) ? $v['avg_waittime_str'] : 0); } } $result .= self::formatTable($header, $data, self::FIELD_LENGTH) . "\n\n"; $result .= Resources::Get('report.interceptedvisitors.title') . "\n"; $report = MapperFactory::getMapper('LostVisitor')->getReportInterceptedByOperator($start, $end); $data = array(); $header = array(Resources::Get('report.interceptedvisitors.1'), Resources::Get('report.interceptedvisitors.2'), Resources::Get('report.interceptedvisitors.3')); if (!empty($report)) { foreach ($report as $v) { $data[] = array($v['name'], isset($v['lost_vistors_count']) ? $v['lost_vistors_count'] : 0, isset($v['avg_waittime_str']) ? $v['avg_waittime_str'] : 0); } } $result .= self::formatTable($header, $data, self::FIELD_LENGTH); return $result; }
$TML->assign('phone', getSecureText($phone)); $TML->assign('message', getSecureText($message)); $TML->assign('canChangeName', getSecureText($canChangeName)); $TML->assign('captcha_num', ''); $TML->display('leave-message.tpl'); exit; } $visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession(); $params = array(); $params['visitsessionid'] = $visitSessionId; $params['lastpingvisitor'] = null; $params['offline'] = 1; $threads_count = MapperFactory::getMapper('Thread')->getNonEmptyThreadsCountByVisitorId($visitorid); $thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_CLOSED, $params); VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1)); Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread); Thread::getInstance()->PostMessage($thread['threadid'], KIND_USER, Resources::Get('chat.window.offline_message', array($message))); MapperFactory::getMapper('Thread')->incrementVisitorMessageCount($thread['threadid']); $first_message = MapperFactory::getMapper('Message')->getFirstMessage($thread['threadid']); Visitor::getInstance()->setVisitorNameCookie($visitor_name); // отправке диалогов из мессенджера $subject = $dept && isset($aDko[$dept]['subject']) ? $subject = $aDko[$dept]['subject'] : Resources::Get('leavemail.subject', array($visitor_name), WEBIM_CURRENT_LOCALE); $body = Resources::Get('leavemail.body', array($visitor_name, $email, $message, $phone, Thread::getInstance()->formatOpenerWithTitle(), HTTP_PREFIX . $_SERVER['HTTP_HOST'] . WEBIM_ROOT . '/operator/threadprocessor.php?threadid=' . $thread['threadid'], str_replace("\n", "\n\n", $first_message['message'])), WEBIM_CURRENT_LOCALE); // отправке диалогов из мессенджера if ($dept && ($feedback = feedbackAdd($dept, $visitor_name, $email, $body, get_uid(false)))) { $body .= "\n" . '[[UCODE::{' . $feedback['uc'] . '},FID::{' . $feedback['id'] . '}]]'; } // отправке диалогов из мессенджера $inbox_mail = $dept && isset($aDko[$dept]['email']) ? $aDko[$dept]['email'] : Settings::Get('offline_email'); webim_mail($inbox_mail, $visitor_name . '<' . $email . '>', $subject, $body); $TML->display('leave-message-sent.tpl');
<?php /* * * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'leftMenu.departments'; require_once dirname(__FILE__) . '/inc/admin_prolog.php'; require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/models/generic/class.mapperfactory.php'; Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $TML = new SmartyClass($TITLE_KEY); $departments = MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale()); $TML->assign('departments', $departments); $TML->display('departments.tpl'); require_once dirname(__FILE__) . '/inc/admin_epilog.php';
function SetInvitationState($visitedpageid, $state) { $visitedpage = $this->GetVisitedPageById($visitedpageid); MapperFactory::getMapper("Invitation")->save(array('state' => $state, 'invitationid' => $visitedpage['invitationid'])); }
public function GetInvitationMessageById($messageId) { return MapperFactory::getMapper('Message')->getById($messageId); }
private function ensureLoaded() { if (!isset($this->settings)) { $this->settings = MapperFactory::getMapper('Config')->enumPairs(); } }
public function GetFirstPage($visitSessionId) { $row = MapperFactory::getMapper("VisitedPage")->getFirstBySessionId($visitSessionId); return $row; }
public function ensureOperatorsAreInLastAccess() { $ids = MapperFactory::getMapper('OperatorOnline')->enumAllAccessedOperatorsWithoutLastAccess(); foreach ($ids as $id) { MapperFactory::getMapper('OperatorLastAccess')->save(array('operatorid' => $id['operatorid'], 'lastvisited' => null)); } }
function ProcessOpenThreads() { $threads = MapperFactory::getMapper("Thread")->enumOpenWithTimeout(PROCESS_THREADS_DELAY); foreach ($threads as $thread) { $this->ProcessThread($thread['threadid'], 'idle'); } }
$endday = verify_param("endday", "/^\\d+\$/"); $endmonth = verify_param("endmonth", "/^\\d{2}.\\d{2}\$/"); $start = get_form_date($startday, $startmonth); $end = get_form_date($endday, $endmonth) + 24 * 60 * 60; $locale = verify_param("locale", "/^(en|ru)\$/"); $departmentid = verify_param("departmentid", "/^\\d+\$/"); if ($start > $end) { $errors[] = Resources::Get("statistics.wrong.dates"); } Operator::getInstance()->loadOnlineStatsIntoDB(); $tmlPage['reportByDate'] = MapperFactory::getMapper("Thread")->getReportByDate($start, $end, $departmentid, $locale); $tmlPage['reportByDateTotal'] = MapperFactory::getMapper("Thread")->getReportTotalByDate($start, $end, $departmentid, $locale); $tmlPage['reportByAgent'] = Thread::getInstance()->GetReportByAgent($start, $end, $departmentid, $locale); $tmlPage['reportLostVisitors'] = MapperFactory::getMapper("LostVisitor")->getReportByOperator($start, $end, $departmentid, $locale); $tmlPage['reportInterceptedVisitors'] = MapperFactory::getMapper("LostVisitor")->getReportInterceptedByOperator($start, $end, $departmentid, $locale); $tmlPage['reportByAgentByDate'] = MapperFactory::getMapper("Operator")->getAdvancedReportByDate($start, $end, $departmentid, $locale); $tmlPage['locale'] = $locale; $tmlPage['departmentid'] = $departmentid; $tmlPage['showresults'] = count($errors) ? 0 : 1; $tmlPage["formstartday"] = date("d", $start); $tmlPage["formstartmonth"] = date("m.y", $start); $tmlPage["formendday"] = date("d", $end - 24 * 60 * 60); $tmlPage["formendmonth"] = date("m.y", $end - 24 * 60 * 60); } else { $curr = getdate($currTime); if ($curr['mday'] < 7) { // previous month if ($curr['mon'] == 1) { $month = 12; $year = $curr['year'] - 1; } else {
if (isset($_REQUEST['act'])) { switch ($_REQUEST['act']) { case 'removerate': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $rateid = verify_param('rateid', "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . '/operator/threadprocessor.php?threadid=' . $threadid; Thread::getInstance()->removeRate($rateid); header('Location: ' . $url); exit; break; case 'removethread': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $threadid = verify_param('threadid', "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . '/operator/threadprocessor.php?threadid=' . $threadid; $TML->assign('removed_thread', true); MapperFactory::getMapper('Thread')->delete($threadid); //Thread::getInstance()->removeRate($rateid); //header("Location: ".$url); //exit(); break; case 'removehistory': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $url = WEBIM_ROOT . '/operator/history.php'; // TODO history Thread::getInstance()->removeHistory($threadid); header('Location: ' . $url); exit; break; } } $TML->display('thread_log.tpl');
$TML->assign('RAND', rand(1000, 9999)); $args = array(); foreach ($_GET as $key => $item) { if ($key != 'action') { $args[] = "{$key}={$item}"; } } $TML->assign('chaturi', "./?a=5" . join('&', $args)); $TML->assign('MAX_FILES', feedback::MAX_FILES); $TML->assign('u_token_key', $_SESSION['rand']); if ($has_errors) { echo "Error:{$errors[0]};{$errors['1']}" . ($errors[2] ? ';' . $errors[2] : ''); exit; } $visitSessionId = VisitSession::GetInstance()->updateCurrentOrCreateSession(); $params = array(); $params['visitsessionid'] = $visitSessionId; $params['lastpingvisitor'] = null; $params['offline'] = 1; $threads_count = MapperFactory::getMapper("Thread")->getNonEmptyThreadsCountByVisitorId($visitorid); $thread = Thread::getInstance()->CreateThread(WEBIM_CURRENT_LOCALE, STATE_CLOSED, $params); VisitSession::GetInstance()->UpdateVisitSession($visitSessionId, array('hasthread' => 1)); Thread::getInstance()->sendFirstMessageWithVisitorInfo($thread); Visitor::getInstance()->setVisitorNameCookie($visitor_name); $feedback = new feedback(); $uid = get_uid(false); $login = $_SESSION['webim_uname']; $email = $_SESSION['webim_email']; $feedback->Add($uid, $login, $email, $department, iconv("UTF-8", "WINDOWS-1251//IGNORE", $message), $attach); echo "Success: ok"; exit;
} $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""; if (empty($visitor)) { return; } Thread::getInstance()->SendVisitedPageForOpenThreads($visitor['id'], $referer, $referer_title); } header('Content-type: text/javascript; charset='.BROWSER_CHARSET); ?> var rules = [ <?php $rules = MapperFactory::getMapper("AutoInvite")->getAll(); foreach ($rules as $rule): if(WEBIM_ENCODING != 'UTF-8') { $rule['text'] = smarticonv('cp1251', 'utf-8', $rule['text']); } ?> { id: <?php echo $rule['autoinviteid']; ?>, text: <?php echo $json->encode($rule['text'])?>, conditions: <?php echo $rule['conditions']?> }, <?endforeach;?> ]; <?php require_once('./ainvite.js'); ?>
function getCurrentTime() { return MapperFactory::getMapper("Time")->getCurrentTime(); }
function GetInvitationMessageById($messageId) { return MapperFactory::getMapper("Message")->getById($messageId); }
* Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'page_ban.title'; require_once dirname(__FILE__) . '/inc/admin_prolog_before.php'; require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.adminurl.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.visitsession.php'; require_once '../classes/models/generic/class.mapperfactory.php'; $banMapper = MapperFactory::getMapper('Ban'); $TML = new SmartyClass($TITLE_KEY); if (!isset($_REQUEST['submitted'])) { if (isset($_REQUEST['address'])) { $TML->assign('address', $_REQUEST['address']); } $TML->assign('till', date(getDateTimeFormat(), time() + 24 * 60 * 60)); // next day } $operator = Operator::getInstance()->GetLoggedOperator(); $errors = array(); if (isset($_REQUEST['submitted'])) { $banid = verify_param('banid', "/^(\\d{1,9})?\$/", ''); $address = get_mandatory_param('address'); $till = get_mandatory_param('till'); $comment = get_mandatory_param('comment');
function setAllDepartments() { global $TML; $operator = Operator::getInstance()->GetLoggedOperator(false); $departments = MapperFactory::getMapper("OperatorDepartment")->enumDepartmentsWithOperator($operator['operatorid'], Resources::getCurrentLocale()); $TML->assign('departments', $departments); }
<?php /* * * Данный файл является частью проекта Веб Мессенджер. * * Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'leftMenu.auto_invites'; require_once dirname(__FILE__) . '/inc/admin_prolog.php'; require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/models/generic/class.mapperfactory.php'; Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $TML = new SmartyClass($TITLE_KEY); $TML->assign('invites', MapperFactory::getMapper('AutoInvite')->getAll()); $TML->display('auto_invites.tpl');
if (isset($_REQUEST['act'])) { switch ($_REQUEST['act']) { case 'removerate': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $rateid = verify_param("rateid", "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . "/operator/threadprocessor.php?threadid=" . $threadid; Thread::getInstance()->removeRate($rateid); header("Location: " . $url); exit; break; case 'removethread': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $threadid = verify_param("threadid", "/^(\\d{1,9})?\$/"); $url = WEBIM_ROOT . "/operator/threadprocessor.php?threadid=" . $threadid; $TML->assign("removed_thread", true); MapperFactory::getMapper("Thread")->delete($threadid); //Thread::getInstance()->removeRate($rateid); //header("Location: ".$url); //exit(); break; case 'removehistory': Operator::getInstance()->IsCurrentUserAdminOrRedirect(); $url = WEBIM_ROOT . "/operator/history.php"; // TODO history Thread::getInstance()->removeHistory($threadid); header("Location: " . $url); exit; break; } } $TML->display('thread_log.tpl');
* Все права защищены. (c) 2005-2009 ООО "ТОП". * Данное программное обеспечение и все сопутствующие материалы * предоставляются на условиях лицензии, доступной по адресу * http://webim.ru/license.html * */ $TITLE_KEY = 'page_ban.title'; require_once dirname(__FILE__) . '/inc/admin_prolog_before.php'; require_once '../classes/functions.php'; require_once '../classes/class.operator.php'; require_once '../classes/class.adminurl.php'; require_once '../classes/class.smartyclass.php'; require_once '../classes/class.thread.php'; require_once '../classes/class.visitsession.php'; require_once '../classes/models/generic/class.mapperfactory.php'; $banMapper = MapperFactory::getMapper("Ban"); $TML = new SmartyClass($TITLE_KEY); if (!isset($_REQUEST['submitted'])) { if (isset($_REQUEST['address'])) { $TML->assign('address', $_REQUEST['address']); } $TML->assign('till', date(getDateTimeFormat(), time() + 24 * 60 * 60)); // next day } $operator = Operator::getInstance()->GetLoggedOperator(); $errors = array(); if (isset($_REQUEST['submitted'])) { $banid = verify_param("banid", "/^(\\d{1,9})?\$/", ""); $address = get_mandatory_param("address"); $till = get_mandatory_param("till"); $comment = get_mandatory_param('comment');
public function getListThreads($currentoperatorid, $q, $show_empty = true, $checkDepartmentsAccess = true, $start_date = null, $end_date = null, $operatorid = null, $offset = null, $limit = null, $departmentid = null, $locale = null, $rate = null) { $departmentsExist = count(MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale())); // TODO probably not the best place $query_params = array(); $sql = ' SELECT WM_UNIX_TIMESTAMP(t."created") "created", WM_UNIX_TIMESTAMP(t."modified") "modified", t."threadid", t."operatorfullname", t."visitormessagecount" as "size", v."ip" as "remote", v."remotehost", v."visitorname" FROM "{thread}" t LEFT JOIN "{visitsession}" v ON v."visitsessionid" = t."visitsessionid" WHERE 1=1'; if (!empty($q)) { $query_params['query'] = "%%{$q}%%"; $sql .= ' AND (t."threadid" IN ( SELECT "threadid" FROM "{message}" m WHERE m."sendername" LIKE :query OR m."message" LIKE :query ) OR v."visitorid" LIKE :query OR v."ip" LIKE :query OR v."remotehost" LIKE :query OR t."operatorfullname" LIKE :query )'; } if (!empty($rate)) { $sign = $rate == 'positive' ? '>' : '<'; $sql .= ' AND EXISTS(SELECT * FROM "{rate}" r WHERE r."threadid"=t."threadid" AND r."rate" ' . $sign . ' 0 AND r."deldate" IS NULL)'; } if ($checkDepartmentsAccess) { $sql .= ' AND (t."departmentid" IS NULL OR EXISTS(SELECT * FROM "{operatordepartment}" od WHERE od."operatorid"=:currentoperatorid AND od."departmentid"=t."departmentid"))'; $query_params['currentoperatorid'] = $currentoperatorid; } if (!$show_empty) { $sql .= ' AND t."visitormessagecount" > 0 '; } if ($start_date !== null) { $query_params['start_date'] = $start_date; $sql .= ' AND WM_UNIX_TIMESTAMP(t."created") >= :start_date'; } if ($end_date !== null) { $query_params['end_date'] = $end_date; $sql .= ' AND WM_UNIX_TIMESTAMP(t."created") < :end_date'; } if ($operatorid !== null) { $query_params['operatorid'] = $operatorid; $sql .= ' AND (:operatorid IS NULL OR t."operatorid"=:operatorid)'; } if (!empty($departmentid)) { $query_params['departmentid'] = $departmentid; $sql .= ' AND t."departmentid" = :departmentid '; } if (!empty($locale)) { $query_params['locale'] = $locale; $sql .= ' AND t."locale" = :locale '; } if ($limit !== null && $offset !== null) { $query_params['limit'] = $limit; $query_params['offset'] = $offset; $sql .= " AND rownum BETWEEN :offset AND :limit"; } $sql .= ' ORDER BY t."created" DESC'; try { $this->db->query($sql, $query_params); $result = $this->db->getArrayOfRows(); } catch (Exception $e) { return array(); } foreach ($result as $k => $v) { $geodata = GeoIPLookup::getGeoDataByIP($v['remote']); //for testing purpose //$geodata = GeoIPLookup::getGeoDataByIP('89.113.218.99'); if ($geodata == NULL) { $geodata = array('city' => null, 'country' => null, 'lat' => null, 'lng' => null); } $result[$k] = array_merge($v, $geodata); $result[$k]['created'] = date(getDateTimeFormat(), $v['created']); $result[$k]['modified'] = date(getDateTimeFormat(), $v['modified']); $result[$k]['diff'] = webim_date_diff($v['modified'] - $v['created']); } return $result; }