/** * Display user logins list * @access public * @param string $templateFile * @param array $list * @param int $page * @param int $browser * @param int $loginDate * @param int $sortField * @param int $orderBy * @return void */ public function loginsUser($templateFile, $list, $page, $browser, $loginDate, $sortField, $orderBy) { $dotGeoip = new Dot_Geoip(); $geoIpWorking = true; $this->tpl->setFile('tpl_main', 'user/' . $templateFile . '.tpl'); $this->tpl->setBlock('tpl_main', 'browser', 'browser_row'); $browserArray = Dot_UserAgent_Utilities::getBrowserArray(); foreach ($browserArray as $key => $val) { $this->tpl->setVar('BROWSERNAME', ucfirst($val['uaBrowser'])); if (strtolower($val['uaBrowser']) == strtolower($browser)) { $this->tpl->setVar('BROWSERSEL', 'selected'); } else { $this->tpl->setVar('BROWSERSEL', ''); } $this->tpl->parse('browser_row', 'browser', true); } $this->tpl->setVar('FILTERDATE', $loginDate); $this->tpl->setBlock('tpl_main', 'list', 'list_block'); $this->tpl->paginator($list['pages']); $this->tpl->setVar('PAGE', $page); $this->tpl->setVar('FILTER_URL', '/admin/user/logins'); $sortableFields = array('username', 'dateLogin'); foreach ($sortableFields as $field) { $linkSort = '/admin/user/logins/sort/' . $field . '/order/'; $linkSort .= $orderBy == 'asc' ? 'desc' : 'asc'; $this->tpl->setVar('LINK_SORT_' . strtoupper($field), $linkSort); if ($field != $sortField) { $sortClass = 'sortable'; } elseif ($orderBy == 'asc') { $sortClass = 'sort_up'; } else { $sortClass = 'sort_down'; } $this->tpl->setVar('CLASS_SORT_' . strtoupper($field), $sortClass); } foreach ($list['data'] as $k => $v) { $country = $dotGeoip->getCountryByIp($v['ip']); if ($country['response'] != 'OK' && $geoIpWorking === true) { $geoIpWorking = false; $this->session->message['txt'] = $country['response']; $this->session->message['type'] = 'warning'; } $this->tpl->setVar('ID', $v['id']); $this->tpl->setVar('USERID', $v['userId']); $this->tpl->setVar('USERNAME', $v['username']); $this->tpl->setVar('IP', $v['ip']); $this->tpl->setVar('COUNTRYIMAGE', strtolower($country[0])); $this->tpl->setVar('COUNTRYNAME', $country[1]); $this->tpl->setVar('REFERER', $v['referer']); $this->tpl->setVar('WHOISURL', $this->settings->whoisUrl); $this->tpl->setVar('USERAGENT', $v['userAgent']); $this->tpl->setVar('BROWSERIMAGE', Dot_UserAgent_Utilities::getBrowserIcon($v['userAgent'])); $os = Dot_UserAgent_Utilities::getOsIcon($v['userAgent']); $this->tpl->setVar('OSIMAGE', $os['icon']); $this->tpl->setVar('OSMAJOR', $os['major']); $this->tpl->setVar('OSMINOR', $os['minor']); $this->tpl->setVar('DATELOGIN', Dot_Kernel::timeFormat($v['dateLogin'], 'long')); $this->tpl->parse('list_block', 'list', true); } }
/** * Display user logins list * @access public * @param string $templateFile * @param array $list * @param int $page * @return void */ public function loginsUser($templateFile, $list, $page) { $dotGeoip = new Dot_Geoip(); $geoIpWorking = true; $this->tpl->setFile('tpl_main', 'admin/' . $templateFile . '.tpl'); $this->tpl->setBlock('tpl_main', 'list', 'list_block'); $this->tpl->paginator($list['pages']); $this->tpl->setVar('PAGE', $page); foreach ($list['data'] as $k => $v) { $country = $dotGeoip->getCountryByIp($v['ip']); if ($country['response'] != 'OK' && $geoIpWorking === true) { $geoIpWorking = false; $this->session->message['txt'] = $country['response']; $this->session->message['type'] = 'warning'; } $this->tpl->setVar('ID', $v['id']); $this->tpl->setVar('ADMINID', $v['adminId']); $this->tpl->setVar('USERNAME', $v['username']); $this->tpl->setVar('IP', $v['ip']); $this->tpl->setVar('COUNTRYIMAGE', strtolower($country[0])); $this->tpl->setVar('COUNTRYNAME', $country[1]); $this->tpl->setVar('REFERER', $v['referer']); $this->tpl->setVar('WHOISURL', $this->settings->whoisUrl); $this->tpl->setVar('USERAGENT', $v['userAgent']); $this->tpl->setVar('BROWSERIMAGE', Dot_UserAgent_Utilities::getBrowserIcon($v['userAgent'])); $os = Dot_UserAgent_Utilities::getOsIcon($v['userAgent']); $this->tpl->setVar('OSIMAGE', $os['icon']); $this->tpl->setVar('OSMAJOR', $os['major']); $this->tpl->setVar('OSMINOR', $os['minor']); $this->tpl->setVar('DATELOGIN', Dot_Kernel::timeFormat($v['dateLogin'], 'long')); $this->tpl->parse('list_block', 'list', true); } }
// call showPage method to view the home page $pageView->showPage('home'); if ($_SERVER['REQUEST_METHOD'] === "POST" && array_key_exists('phone', $_POST) && array_key_exists('phone', $_POST) && array_key_exists('email', $_POST) && array_key_exists('message', $_POST)) { // validate the response $values = array('email' => array('email' => $_POST['email']), 'details' => array('message' => $_POST['message'])); //if phone is completed, validate phone to be from US if ($_POST['phone'] != '') { $values['phone'] = array('phone' => $_POST['phone']); } $dotValidateUser = new Dot_Validate_User(array('who' => 'mobile', 'action' => 'form', 'values' => $values)); if ($dotValidateUser->isValid()) { //if valid, send a mail $data = $dotValidateUser->getData(); $dotEmail = new Dot_Email(); $dotEmail->addTo($settings->siteEmail); $dotEmail->setSubject($registry->seo->siteName . ' - ' . $option->contactForm->subject); $msg = str_replace(array('%EMAIL%', '%PHONE%', '%MESSAGE%', '%DATE%', '%IP%', '%USERAGENT%'), array($data['email'], isset($data['phone']) ? $data['phone'] : '', $data['message'], Dot_Kernel::timeFormat('now'), Dot_Kernel::getUserIp(), $_SERVER['HTTP_USER_AGENT']), $option->contactForm->message); $dotEmail->setBodyText($msg); $dotEmail->send(); /** If you want to redirect to a link, * uncomment the 2 lines below to display a message */ $tpl->setVar('ERROR_MESSAGE', $option->contactForm->mailSent); } else { $session->message['txt'] = $dotValidateUser->getError(); $session->message['type'] = 'error'; $pageView->showPage('home', $dotValidateUser->getData()); } } break; }
/** * Failed admin login - send email notice to valid admin account * @access private * @param arry $values * @return void */ private function sendEmailFailedLogin($values) { // get all admin list $emailAdminList = explode(',', $this->settings->devEmails); $dotEmail = new Dot_Email(); // Add each admin foreach ($emailAdminList as $emailAdmin) { $dotEmail->addTo($emailAdmin); } $dotEmail->setSubject($this->seo->siteName . ' - ' . $this->option->failedLogin->subject); $dotGeoip = new Dot_Geoip(); $country = $dotGeoip->getCountryByIp(Dot_Kernel::getUserIp()); $msg = str_replace(array('%LINK%', '%USERNAME%', '%PASSWORD%', '%DATE%', '%COUNTRY%', '%IP%', '%USERAGENT%'), array($this->config->website->params->url . '/' . Zend_Registry::get('requestModule'), $values['username'], $values['password'], Dot_Kernel::timeFormat('now', 'long'), $country[1], Dot_Kernel::getUserIp(), $this->_userAgent), $this->option->failedLogin->message); $dotEmail->setBodyText($msg); $success = $dotEmail->send(); return $success; }