public static function onAccess(Module_Account $module, GWF_User $user) { $alert = false; $table = self::table(__CLASS__); # Check UA $ua = self::uahash(); if ($user->isOptionEnabled(GWF_User::ALERT_UAS)) { if (!$table->selectVar('1', "accacc_uid={$user->getID()} AND accacc_ua=" . self::hashquote($ua))) { $alert = true; } } # Check exact IP $ip = GWF_IP6::getIP(GWF_IP_EXACT); if ($user->isOptionEnabled(GWF_User::ALERT_IPS)) { if (!$table->selectVar('1', "accacc_uid={$user->getID()} AND accacc_ip='" . $table->escape($ip) . "'")) { $alert = true; } } $isp = null; if ($user->isOptionEnabled(GWF_User::ALERT_ISPS)) { $isp = self::isphash(); if (!$table->selectVar('1', "accacc_uid={$user->getID()} AND accacc_isp=" . self::hashquote($isp))) { $alert = true; } } if ($alert === true) { self::sendAlertMail($module, $user, 'record_alert'); } $data = array('accacc_uid' => $user->getID(), 'accacc_ip' => $ip, 'accacc_isp' => $isp, 'accacc_ua' => $ua, 'accacc_time' => time()); $table->insertAssoc($data); }
public function execute() { GWF3::setConfig('log_request', false); $_GET['ajax'] = 1; $cut = time() - GWF_ONLINE_TIMEOUT; $user = new GWF_User(); $table = GDO::table('GWF_Session'); $profiles = ''; if (false === ($result = $table->select('sess_user,user_name,user_options,user_level', "sess_time>={$cut}", 'user_name ASC', array('user')))) { return; } $guest = 0; $member = 0; $total = 0; $u_count = array(); $u_users = array(); while (false !== ($row = $table->fetch($result, GDO::ARRAY_A))) { $total++; $uid = $row['sess_user']; if ($uid == 0) { $guest++; continue; } $member++; $user->setGDOData($row); if ($user->isOptionEnabled(GWF_User::HIDE_ONLINE)) { continue; } if (isset($u_count[$uid])) { $u_count[$uid]++; } else { $u_count[$uid] = 1; $u_users[$uid] = $user->displayProfileLink(); } } $table->free($result); foreach ($u_count as $uid => $cnt) { $multi = $cnt > 1 ? "(x{$cnt})" : ''; $profiles .= ', ' . $u_users[$uid] . $multi; } $profiles = $profiles === '' ? '.' : ': ' . substr($profiles, 2) . '.'; return sprintf('%s Online%s', $total, $profiles); }
private function contactData(GWF_User $user) { require_once GWF_CORE_PATH . 'module/Profile/GWF_Profile.php'; if (false === ($p = GWF_Profile::getProfile($user->getID()))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if ($p->isGuestHidden() || $p->isHiddenLevel(0)) { return ''; } $back = ''; if ('' !== ($v = $p->getVar('prof_firstname'))) { $back .= 'FirstName:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_lastname'))) { $back .= 'LastName:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_street'))) { $back .= 'Street:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_city'))) { $back .= 'City:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_zip'))) { $back .= 'ZIPCode:' . $v . PHP_EOL; } if ($p->isContactHiddenLevel(0)) { return $back; } if ($user->isOptionEnabled(GWF_User::SHOW_EMAIL)) { if ('' !== ($v = $user->displayEMail())) { $back .= 'EMail:' . $v . PHP_EOL; } } if ('' !== ($v = $p->getVar('prof_tel'))) { $back .= 'Tel:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_mobile'))) { $back .= 'Mobile:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_icq'))) { $back .= 'ICQ:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_msn'))) { $back .= 'MSN:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_jabber'))) { $back .= 'Jabber:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_skype'))) { $back .= 'Skype:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_yahoo'))) { $back .= 'Yahoo!:' . $v . PHP_EOL; } if ('' !== ($v = $p->getVar('prof_aim'))) { $back .= 'AIM:' . $v . PHP_EOL; } return $back; }
private function changeFlag(GWF_User $user, $flagname, $bits) { $newFlag = Common::getPost($flagname) !== false; $oldFlag = $user->isOptionEnabled($bits); if ($newFlag === $oldFlag) { return ''; } if (!$user->saveOption($bits, $newFlag)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_' . $flagname . ($newFlag ? '_on' : '_off')); }