本文整理汇总了PHP中e107::getIPHandler方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getIPHandler方法的具体用法?PHP e107::getIPHandler怎么用?PHP e107::getIPHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getIPHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init_session
/**
* The whole could happen inside e_user class
* @return void
*/
function init_session()
{
/*
# Validate user
#
# - parameters none
# - return boolean
# - scope public
*/
// ----------------------------------------
global $user_pref, $currentUser;
$e107 = e107::getInstance();
// New user model
$user = e107::getUser();
define('USERIP', e107::getIPHandler()->getIP(FALSE));
define('POST_REFERER', md5($user->getToken()));
// Check for intruders - outside the model for now
// TODO replace __referer with e-token, remove the above
if (isset($_POST['__referer']) && !$user->checkToken($_POST['__referer']) || isset($_GET['__referer']) && !$user->checkToken($_GET['__referer'])) {
// Die, die, die! DIE!!!
die('Unauthorized access!');
}
if (e107::isCli()) {
define('USER', true);
define('USERID', 1);
define('USERNAME', 'e107-cli');
define('USERTHEME', false);
define('ADMIN', true);
define('GUEST', false);
define('USERCLASS', '');
define('USEREMAIL', '');
define('USERCLASS_LIST', '');
define('USERCLASS', '');
define('USERJOINED', '');
return;
}
if ($user->hasBan()) {
$msg = e107::findPref('ban_messages/6');
if ($msg) {
echo e107::getParser()->toHTML($msg);
}
exit;
}
if (!$user->isUser()) {
define('USER', false);
define('USERID', 0);
define('USERTHEME', false);
define('ADMIN', false);
define('GUEST', true);
define('USERCLASS', '');
define('USEREMAIL', '');
define('USERSIGNATURE', '');
if ($user->hasSessionError()) {
define('LOGINMESSAGE', CORE_LAN10);
define('CORRUPT_COOKIE', true);
}
} else {
// we shouldn't use getValue() here, it's there for e.g. shortcodes, profile page render etc.
define('USERID', $user->getId());
define('USERNAME', $user->get('user_name'));
define('USERURL', $user->get('user_homepage', false));
//required for BC
define('USEREMAIL', $user->get('user_email'));
define('USER', true);
define('USERCLASS', $user->get('user_class'));
define('USERIMAGE', $user->get('user_image'));
define('USERPHOTO', $user->get('user_sess'));
define('USERJOINED', $user->get('user_join'));
define('USERVISITS', $user->get('user_visits'));
define('USERSIGNATURE', $user->get('user_signature'));
define('ADMIN', $user->isAdmin());
define('ADMINID', $user->getAdminId());
define('ADMINNAME', $user->getAdminName());
define('ADMINPERMS', $user->getAdminPerms());
define('ADMINEMAIL', $user->getAdminEmail());
define('ADMINPWCHANGE', $user->getAdminPwchange());
if (ADMIN) {
e107::getRedirect()->setPreviousUrl();
}
define('USERLV', $user->get('user_lastvisit'));
// BC - FIXME - get rid of them!
$currentUser = $user->getData();
$currentUser['user_realname'] = $user->get('user_login');
// Used by force_userupdate
$e107->currentUser =& $currentUser;
// if(defined('SETTHEME')) //override - within e_module for example.
// {
// $_POST['sitetheme'] = SETTHEME;
// $_POST['settheme'] = 1;
// }
// XXX could go to e_user class as well
if ($user->checkClass(e107::getPref('allow_theme_select', false), false)) {
// User can set own theme
if (isset($_POST['settheme'])) {
$uconfig = $user->getConfig();
if (e107::getPref('sitetheme') != $_POST['sitetheme']) {
//.........这里部分代码省略.........
示例2: trim
if ((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] != '') {
if (!USER && !$pref['anon_post']) {
// disallow post
} else {
$nick = trim(preg_replace("#\\[.*\\]#si", "", $tp->toDB($_POST['nick'])));
$cmessage = $_POST['cmessage'];
$cmessage = preg_replace("#\\[.*?\\](.*?)\\[/.*?\\]#s", "\\1", $cmessage);
$fp = new floodprotect();
if ($fp->flood("chatbox", "cb_datestamp")) {
if (strlen(trim($cmessage)) < 1000 && trim($cmessage) != "") {
$cmessage = $tp->toDB($cmessage);
if ($sql->select("chatbox", "*", "cb_message='{$cmessage}' AND cb_datestamp+84600>" . time())) {
$emessage = CHATBOX_L17;
} else {
$datestamp = time();
$ip = e107::getIPHandler()->getIP(FALSE);
if (USER) {
$nick = USERID . "." . USERNAME;
$sql->db_Update("user", "user_chats=user_chats+1, user_lastpost='" . time() . "' WHERE user_id='" . USERID . "' ");
} else {
if (!$nick) {
$nick = "0.Anonymous";
} else {
if ($sql->select("user", "*", "user_name='{$nick}' ")) {
$emessage = CHATBOX_L1;
} else {
$nick = "0." . $nick;
}
}
}
if (!$emessage) {
示例3: number_format
$dbPercent = 100.0 * $db_time / $clockTime;
// Format for display or logging
$rendertime = number_format($clockTime, 2);
// Clock time during page render
$db_time = number_format($db_time, 2);
// Clock time in DB render
$dbPercent = number_format($dbPercent, 0);
// DB as percent of clock
$memuse = eHelper::getMemoryUsage();
// Memory at end, in B/KB/MB/GB ;)
$queryCount = $sql->db_QueryCount();
$rinfo = '';
$logLine = '';
if ($pref['log_page_accesses']) {
// Collect the first batch of data to log
$logLine .= "'" . ($now = time()) . "','" . gmstrftime('%y-%m-%d %H:%M:%S', $now) . "','" . e107::getIPHandler()->getIP(FALSE) . "','" . e_PAGE . '?' . e_QUERY . "','" . $rendertime . "','" . $db_time . "','" . $queryCount . "','" . $memuse . "','" . $_SERVER['HTTP_USER_AGENT'] . "','{$_SERVER["REQUEST_METHOD"]}'";
}
if (function_exists('getrusage')) {
$ru = getrusage();
$cpuUTime = $ru['ru_utime.tv_sec'] + $ru['ru_utime.tv_usec'] * 1.0E-6;
$cpuSTime = $ru['ru_stime.tv_sec'] + $ru['ru_stime.tv_usec'] * 1.0E-6;
$cpuUStart = $eTimingStartCPU['ru_utime.tv_sec'] + $eTimingStartCPU['ru_utime.tv_usec'] * 1.0E-6;
$cpuSStart = $eTimingStartCPU['ru_stime.tv_sec'] + $eTimingStartCPU['ru_stime.tv_usec'] * 1.0E-6;
$cpuStart = $cpuUStart + $cpuSStart;
$cpuTot = $cpuUTime + $cpuSTime;
$cpuTime = $cpuTot - $cpuStart;
$cpuPct = 100.0 * $cpuTime / $rendertime;
/* CPU load during known clock time */
// Format for display or logging (Uncomment as needed for logging)
//$cpuUTime = number_format($cpuUTime, 3); // User cpu
//$cpuSTime = number_format($cpuSTime, 3); // System cpu
示例4: get_poll
function get_poll($query)
{
global $e107;
$sql = e107::getDb();
if ($sql->gen($query)) {
$pollArray = $sql->fetch();
if (!check_class($pollArray['poll_vote_userclass'])) {
$POLLMODE = 'disallowed';
} else {
switch ($pollArray['poll_storage_method']) {
case POLL_MODE_COOKIE:
$userid = '';
$cookiename = 'poll_' . $pollArray['poll_id'];
if (isset($_COOKIE[$cookiename])) {
$POLLMODE = 'voted';
} else {
$POLLMODE = 'notvoted';
}
break;
case POLL_MODE_IP:
$userid = e107::getIPHandler()->getIP(FALSE);
$voted_ids = explode('^', substr($pollArray['poll_ip'], 0, -1));
if (in_array($userid, $voted_ids)) {
$POLLMODE = 'voted';
} else {
$POLLMODE = 'notvoted';
}
break;
case POLL_MODE_USERID:
if (!USER) {
$POLLMODE = 'disallowed';
} else {
$userid = USERID;
$voted_ids = explode('^', substr($pollArray['poll_ip'], 0, -1));
if (in_array($userid, $voted_ids)) {
$POLLMODE = 'voted';
} else {
$POLLMODE = 'notvoted';
}
}
break;
}
}
} else {
return FALSE;
}
if (isset($_POST['pollvote']) && $POLLMODE == 'notvoted' && $POLLMODE != 'disallowed') {
if ($_POST['votea']) {
// $sql -> db_Select("polls", "*", "poll_vote_userclass!=255 AND poll_type=1 ORDER BY poll_datestamp DESC LIMIT 0,1");
$row = $pollArray;
extract($row);
$votes = explode(chr(1), $poll_votes);
if (is_array($_POST['votea'])) {
/* multiple choice vote */
foreach ($_POST['votea'] as $vote) {
$vote = intval($vote);
$votes[$vote - 1]++;
}
} else {
$votes[$_POST['votea'] - 1]++;
}
$optionArray = explode(chr(1), $pollArray['poll_options']);
$optionArray = array_slice($optionArray, 0, -1);
foreach ($optionArray as $k => $v) {
if (!$votes[$k]) {
$votes[$k] = 0;
}
}
$votep = implode(chr(1), $votes);
$pollArray['poll_votes'] = $votep;
$sql->update("polls", "poll_votes = '{$votep}'" . ($pollArray['poll_storage_method'] != POLL_MODE_COOKIE ? ", poll_ip='" . $poll_ip . $userid . "^'" : '') . " WHERE poll_id=" . $poll_id);
/*echo "
<script type='text/javascript'>
<!--
setcook({$poll_id});
//-->
</script>
";
*/
$poll_cookie_expire = time() + 3600 * 24 * 356 * 15;
// FIXME cannot be used after 2023 (this year is the maxium unixstamp on 32 bit system)
cookie('poll_' . $poll_id . '', $poll_id, $poll_cookie_expire);
$POLLMODE = 'voted';
}
}
$this->pollRow = $pollArray;
$this->pollmode = $POLLMODE;
}
示例5: signup
/**
* XUP Signup Method (falls-back to XUP login when existing user is detected).
* May be used as a simple XUP login link for existing and non-existing users.
*/
public function signup($redirectUrl = true, $loginAfterSuccess = true, $emailAfterSuccess = true)
{
if (!e107::getPref('social_login_active', false)) {
throw new Exception("Signup failed! This feature is disabled.", 100);
// TODO lan
}
if (!$this->getProvider()) {
throw new Exception("Signup failed! Wrong provider.", 2);
// TODO lan
}
if ($redirectUrl) {
if (true === $redirectUrl) {
$redirectUrl = SITEURL;
} elseif (strpos($redirectUrl, 'http://') !== 0 && strpos($redirectUrl, 'https://') !== 0) {
$redirectUrl = e107::getUrl()->create($redirectUrl);
}
}
if (e107::getUser()->isUser()) {
if ($redirectUrl) {
e107::getRedirect()->redirect($redirectUrl);
}
return false;
// throw new Exception( "Signup failed! User already signed in. ", 1); // TODO lan
}
$this->adapter = $this->hybridauth->authenticate($this->getProvider());
$profile = $this->adapter->getUserProfile();
// returned back, if success...
if ($profile->identifier) {
$sql = e107::getDb();
$userMethods = e107::getUserSession();
$plainPwd = $userMethods->generateRandomString('************');
// auto plain passwords
// TODO - auto login name, shouldn't be used if system set to user_email login...
$userdata['user_loginname'] = $this->getProvider() . $userMethods->generateUserLogin(e107::getPref('predefinedLoginName', '_..#..#..#'));
$userdata['user_email'] = $sql->escape($profile->emailVerified ? $profile->emailVerified : $profile->email);
$userdata['user_name'] = $sql->escape($profile->displayName);
$userdata['user_login'] = $userdata['user_name'];
$userdata['user_customtitle'] = '';
// not used
$userdata['user_password'] = $userMethods->HashPassword($plainPwd, $userdata['user_loginname']);
// pwd
$userdata['user_sess'] = '';
//
$userdata['user_image'] = $profile->photoURL;
// avatar
$userdata['user_signature'] = '';
// not used
$userdata['user_hideemail'] = 1;
// hide it by default
$userdata['user_xup'] = $sql->escape($this->userId());
$pref = e107::pref('core');
if (!empty($pref['initial_user_classes'])) {
$userdata['user_class'] = $pref['initial_user_classes'];
} elseif (!empty($pref['user_new_period'])) {
$userdata['user_class'] = e_UC_NEWUSER;
} else {
$userdata['user_class'] = '';
}
// print_a($userdata);
// user_name, user_xup, user_email and user_loginname shouldn't match
$insert = !empty($userdata['user_email']) ? "OR user_email='" . $userdata['user_email'] . "' " : "";
if ($sql->count("user", "(*)", "user_xup='" . $sql->escape($this->userId()) . "' " . $insert . " OR user_loginname='{$userdata['user_loginname']}' OR user_name='{$userdata['user_name']}'")) {
// $this->login($redirectUrl); // auto-login
e107::getUser()->loginProvider($this->userId());
if ($redirectUrl) {
e107::getRedirect()->redirect($redirectUrl);
}
return false;
// throw new Exception( "Signup failed! User already exists. Please use 'login' instead.", 3);
}
if (empty($userdata['user_email']) && e107::getPref('disable_emailcheck', 0) == 0) {
throw new Exception("Signup failed! Can't access user email - registration without an email is impossible." . print_a($userdata, true), 4);
// TODO lan
}
// other fields
$now = time();
$userdata['user_id'] = null;
$userdata['user_join'] = $now;
$userdata['user_lastvisit'] = 0;
$userdata['user_currentvisit'] = 0;
$userdata['user_comments'] = 0;
$userdata['user_ip'] = e107::getIPHandler()->getIP(FALSE);
$userdata['user_ban'] = USER_VALIDATED;
$userdata['user_prefs'] = '';
$userdata['user_visits'] = 0;
$userdata['user_admin'] = 0;
$userdata['user_perms'] = '';
$userdata['user_realm'] = '';
$userdata['user_pwchange'] = $now;
$user = e107::getSystemUser(0, false);
$user->setData($userdata);
$user->getExtendedModel();
// init
//$user->setEditor(e107::getSystemUser(1, false));
$user->save(true);
// user model error
//.........这里部分代码省略.........
示例6: notify_flood
function notify_flood($data)
{
$this->send('flood', NT_LAN_FL_1, NT_LAN_FL_2 . ': ' . e107::getIPHandler()->ipDecode($data, TRUE));
}
示例7: afterDelete
public function afterDelete($deleted_data, $id, $deleted_check)
{
e107::getIPHandler()->regenerateFiles();
}
示例8: ListBanTrigger
/**
* Ban user trigger
* @param int $userid
* @return void
*/
public function ListBanTrigger($userid)
{
$sql = e107::getDb();
$mes = e107::getMessage();
$admin_log = e107::getAdminLog();
$iph = e107::getIPHandler();
$sysuser = e107::getSystemUser($userid, false);
if (!$sysuser->getId()) {
$mes->addError(USRLAN_223);
return;
}
$row = $sysuser->getData();
if ($row['user_perms'] == "0" || $row['user_perms'] == "0.") {
$mes->addWarning(USRLAN_7);
} else {
if ($sql->update("user", "user_ban='1' WHERE user_id='" . $userid . "' ")) {
e107::getLog()->add('USET_05', str_replace(array('--UID--', '--NAME--'), array($row['user_id'], $row['user_name']), USRLAN_161), E_LOG_INFORMATIVE);
$mes->addSuccess("(" . $userid . "." . $row['user_name'] . " - {$row['user_email']}) " . USRLAN_8);
}
if (trim($row['user_ip']) == "") {
$mes->addInfo(USRLAN_135);
} else {
if ($sql->count('user', '(*)', "user_ip = '{$row['user_ip']}' AND user_ban=0 AND user_id <> {$userid}") > 0) {
// Other unbanned users have same IP address
$mes->addWarning(str_replace("{IP}", $iph->ipDecode($row['user_ip']), USRLAN_136));
} else {
if ($iph->add_ban(6, USRLAN_149 . $row['user_name'] . '/' . $row['user_loginname'], $row['user_ip'], USERID)) {
// Successful IP ban
$mes->addSuccess(str_replace("{IP}", $iph->ipDecode($row['user_ip']), USRLAN_137));
} else {
// IP address on whitelist
$mes->addWarning(str_replace("{IP}", $iph->ipDecode($row['user_ip']), USRLAN_150));
}
}
}
}
// List data reload
$this->getTreeModel()->load(true);
}
示例9: convert
$message .= "<div class='right'>(<a href='" . e_SELF . "?dabl'>" . FLALAN_16 . "</a>)</div>";
$mes->addInfo($message);
}
$gen = new convert();
$fla_total = $sql->db_Count('generic', '(*)', "WHERE gen_type='failed_login'");
if (!$sql->db_Select('generic', '*', "gen_type='failed_login' ORDER BY gen_datestamp DESC LIMIT {$from},{$amount}")) {
$mes->addInfo(FLALAN_2);
} else {
$faArray = $sql->db_getList('ALL', FALSE, FALSE);
$text = "\n\t\t<form method='post' action='" . e_SELF . "' id='flaform' >\n\t\t\t<fieldset id='core-fla'>\n\t\t\t\t<legend class='e-hideme'>" . ADLAN_146 . "</legend>\n\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t<colgroup>\n\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t<col style='width: 40%' />\n\t\t\t\t\t\t<col style='width: 20%' />\n\t\t\t\t\t\t<col style='width: 10%' />\n\t\t\t\t\t\t<col style='width: 10%' />\n\t\t\t\t\t</colgroup>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>" . LAN_DATE . "</th>\n\t\t\t\t\t\t\t<th>" . FLALAN_7 . "</th>\n\t\t\t\t\t\t\t<th>" . FLALAN_8 . "</th>\n\t\t\t\t\t\t\t<th class='center last'>\n\t\t\t\t\t\t\t\t" . LAN_DELETE . "<br/>\n\t\t\t\t\t\t\t\t" . $frm->checkbox('check_all_del', 'jstarget:fladelete', false, array('id' => false, 'class' => 'checkbox toggle-all')) . "\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t\t<th class='center last'>\n\t\t\t\t\t\t\t\t" . LAN_BAN . "<br/>\n\t\t\t\t\t\t\t\t" . $frm->checkbox_toggle('check-all-ban', 'flaban') . "\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>\n\t";
foreach ($faArray as $fa) {
extract($fa);
//FIXME kill extract()
$gen_chardata = str_replace(":::", "<br />", $tp->toHTML($gen_chardata));
$host = e107::getIPHandler()->get_host_name(getenv($gen_ip));
$text .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>" . $gen->convert_date($gen_datestamp, "forum") . "</td>\n\t\t\t\t\t\t\t<td>" . $gen_chardata . "</td>\n\t\t\t\t\t\t\t<td>" . e107::getIPHandler()->ipDecode($fa['gen_ip']) . "<br />{$host}</td>\n\t\t\t\t\t\t\t<td class='center middle autocheck e-pointer'>\n\t\t\t\t\t\t\t\t" . $frm->checkbox('fladelete[]', $gen_id) . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class='center middle autocheck e-pointer'>\n\t\t\t\t\t\t\t\t" . $frm->checkbox('flaban[]', $gen_id) . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t";
}
$text .= "\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t\t<div class='buttons-bar center'>\n\t\t\t\t\t" . $frm->admin_button('delbanSubmit', FLALAN_10, 'delete', FLALAN_10, 'title=') . "\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t</form>\n\t";
$parms = $fla_total . "," . $amount . "," . $from . "," . e_SELF . '?' . "[FROM]." . $amount;
$nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
if ($nextprev) {
$text .= "<div class='nextprev-bar'>" . $nextprev . "</div>";
}
}
$ns->tablerender(ADLAN_146, $mes->render() . $text);
require_once "footer.php";
/**
* Handle page DOM within the page header
*
* @return string JS source
*/
示例10: foreach
</div>
</div>
*/
$text .= $ns->tablerender("e107 News", $panelRSS, "core-infopanel_news", true);
// ---------------------Latest Stuff ---------------------------
require_once e_CORE . "shortcodes/batch/admin_shortcodes.php";
$text .= $ns->tablerender(ADLAN_LAT_1, $tp->parseTemplate("{ADMIN_LATEST=norender}"), "core-infopanel_latest", true);
$text .= $ns->tablerender(LAN_STATUS, $tp->parseTemplate("{ADMIN_STATUS=norender}"), "core-infopanel_latest", true);
// ---------------------- Who's Online ------------------------
// TODO Could use a new _menu item instead.
$nOnline = e107::getDB()->db_Select('online', '*');
$panelOnline = "\n\t\n\t\t<table class='table adminlist'>\n\t\t<colgroup>\n\t\t\t<col style='width: 10%' />\n <col style='width: 25%' />\n\t\t\t<col style='width: 10%' />\n\t\t\t<col style='width: 40%' />\n\t\t\t<col style='width: auto' />\n\t\t</colgroup>\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th>Timestamp</th>\n\t\t\t\t<th>Username</th>\n\t\t\t\t<th>IP</th>\n\t\t\t\t<th>Page</th>\n\t\t\t\t<th>Agent</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>";
if (e107::getDB()->db_Select('online', '*', "online_ip !='' LIMIT 20")) {
$newsarray = $e107->sql->db_getList();
foreach ($newsarray as $key => $val) {
$panelOnline .= "<tr>\n\t\t\t\t<td class='nowrap'>" . e107::getDateConvert()->convert_date($val['online_timestamp'], '%H:%M:%S') . "</td>\n\t\t\t\t\t<td>" . renderOnlineName($val['online_user_id']) . "</td>\n\t\t\t\t\t<td>" . e107::getIPHandler()->ipDecode($val['online_ip']) . "</td>\n\t\t\t\t\t<td><a href='" . $val['online_location'] . "' title='" . $val['online_location'] . "'>" . $tp->text_truncate($val['online_location'], 50, '...') . "</a></td>\n\t\t\t\t\t<td>" . $tp->text_truncate(str_replace("/", " / ", $val['online_agent']), 20, '...') . "</td>\n\t\t\t\t</tr>\n\t\t\t\t";
}
}
$panelOnline .= "</tbody></table>\n\t";
$text .= $ns->tablerender('Visitors Online : ' . $nOnline, $panelOnline, 'core-infopanel_online', true);
// --------------------- User Selected Menus -------------------
if (varset($pref['core-infopanel-menus'])) {
foreach ($pref['core-infopanel-menus'] as $val) {
$id = $frm->name2id('core-infopanel_' . $val);
$inc = $tp->parseTemplate("{PLUGIN={$val}|TRUE}");
$text .= $inc;
// $text .= $ns->tablerender("", $inc, $id,true);
}
}
$text .= "<div class='clear'> </div>";
$text .= render_infopanel_options();
示例11: __get
public function __get($name)
{
switch ($name) {
case 'tp':
$ret = e107::getParser();
break;
case 'sql':
$ret = e107::getDb();
break;
case 'ecache':
$ret = e107::getCache();
break;
case 'arrayStorage':
$ret = e107::getArrayStorage();
break;
case 'e_event':
$ret = e107::getEvent();
break;
case 'ns':
$ret = e107::getRender();
break;
case 'url':
$ret = e107::getUrl();
break;
case 'admin_log':
$ret = e107::getAdminLog();
break;
case 'override':
$ret = e107::getSingleton('override', e_HANDLER . 'override_class.php');
break;
case 'notify':
$ret = e107::getNotify();
break;
case 'e_online':
$ret = e107::getOnline();
break;
case 'eIPHandler':
$ret = e107::getIPHandler();
break;
case 'user_class':
$ret = e107::getUserClass();
break;
default:
trigger_error('$e107->$' . $name . ' not defined', E_USER_WARNING);
return null;
break;
}
$this->{$name} = $ret;
return $ret;
}
示例12: elseif
$validator = new email_validation_class;
$validator->localuser= $adminuser;
$validator->localhost= $adminhost;
$validator->timeout=3;
// $validator->debug=1;
// $validator->html_debug=1;
if($validator->ValidateEmailBox($sender) != 1)
{
$error .= LANCONTACT_11."\\n";
}
}
*/
// No errors - so proceed to email the admin and the user (if selected).
if (empty($error)) {
$body .= "<br /><br />\n\t\t<table class='table'>\n\t\t<tr>\n\t\t<td>IP:</td><td>" . e107::getIPHandler()->getIP(TRUE) . "</td></tr>";
if (USER) {
$body .= "<tr><td>User:</td><td>#" . USERID . " " . USERNAME . "</td></tr>";
}
if (empty($_POST['contact_person']) && !empty($pref['sitecontacts'])) {
if ($pref['sitecontacts'] == e_UC_MAINADMIN) {
$query = "user_perms = '0' OR user_perms = '0.' ";
} elseif ($pref['sitecontacts'] == e_UC_ADMIN) {
$query = "user_admin = 1 ";
} else {
$query = "FIND_IN_SET(" . $pref['sitecontacts'] . ",user_class) ";
}
} else {
$query = "user_id = " . intval($_POST['contact_person']);
}
if ($sql->gen("SELECT user_name,user_email FROM `#user` WHERE " . $query . " LIMIT 1")) {
示例13: list
$val = $row['dblog_caller'];
if (strpos($val, '|') !== FALSE && strpos($val, '@') !== FALSE) {
list($file, $rest) = explode('|', $val);
list($routine, $rest) = explode('@', $rest);
$val = $file . '<br />Function: ' . $routine . '<br />Line: ' . $rest;
}
break;
case 'dblog_remarks':
// Look for pseudo-code for newlines, link insertion
$val = preg_replace_callback("#\\[!(\\w+?)(=.+?){0,1}!]#", 'log_process', $row['dblog_remarks']);
break;
case 'dblog_ip':
$val = e107::getIPHandler()->ipDecode($row['dblog_ip']);
break;
case 'comment_ip':
$val = e107::getIPHandler()->ipDecode($row['comment_ip']);
/* if (strlen($val) == 8) // New decoder should handle this automatically
{
$hexip = explode('.', chunk_split($val, 2, '.'));
$val = hexdec($hexip[0]). '.'.hexdec($hexip[1]).'.'.hexdec($hexip[2]).'.'.hexdec($hexip[3]);
} */
break;
case 'comment_comment':
$val = $tp->text_truncate($row['comment_comment'], 100, '...');
// Just display first bit of comment
break;
case 'online_location':
$val = str_replace($e107->base_path, '', $row['online_location']);
// Just display site-specific bit of path
break;
case 'del_check':
示例14: cal_log
public function cal_log($event_type, $event_title = '', $event_string = '', $event_start = 0)
{
// All calendar-related logging intentionally passed through a single point to maintain control
// (so we could also add other info if we wanted)
// Event types:
// 1 - add event
// 2 - edit event
// 3 - delete event
// 4 - Bulk delete
// 5 - add multiple events
global $pref;
$e107 = e107::getInstance();
$log_titles = array('1' => 'EC_ADM_01', '2' => 'EC_ADM_02', '3' => 'EC_ADM_03', '4' => 'EC_ADM_04', '5' => 'EC_ADM_05', '6' => 'EC_ADM_06', '7' => 'EC_ADM_07', '8' => 'EC_ADM_08', '9' => 'EC_ADM_09', '10' => 'EC_ADM_10', '11' => 'EC_ADM_11');
// Do the notifies first
$cmessage = $log_titles[$event_type] . "<br />";
if ($event_start > 0) {
$cmessage .= 'Event Start: ' . strftime("%d-%B-%Y", $event_start) . "<br />";
$cmessage .= 'Event Link: ' . SITEURL . e_PLUGIN_ABS . 'calendar_menu/event.php?' . $event_start . " <br />";
} else {
$cmessage .= "Event Start unknown<br />";
}
$edata_ec = array('cmessage' => $cmessage, 'ip' => e107::getIPHandler()->getIP(FALSE));
switch ($event_type) {
case 5:
case 1:
$e107->e_event->trigger('ecalnew', $edata_ec);
break;
case 2:
case 3:
case 4:
$e107->e_event->trigger('ecaledit', $edata_ec);
break;
}
switch ($pref['eventpost_adminlog']) {
case 1:
if ($event_type == '1') {
return;
}
case 2:
break;
// Continue
// Continue
default:
return;
// Invalid or undefined option
}
$log_detail = array('1' => 'Event Calendar - add event ' . strftime("%d-%B-%Y", $event_start), '2' => 'Event Calendar - edit event ' . strftime("%d-%B-%Y", $event_start), '3' => 'Event Calendar - delete event ' . strftime("%d-%B-%Y", $event_start), '4' => 'Event Calendar - Bulk Delete', '5' => 'Event Calendar - multiple add ' . strftime("%d-%B-%Y", $event_start));
$e107->admin_log->log_event($log_titles[$event_type], $event_title . " \n" . $log_detail[$event_type] . "\n" . $event_string, '');
}
示例15: addslashes
} else {
$colour = '??';
}
if ($err_code = strip_tags(isset($vals['err_direct']) ? $vals['err_direct'] : '')) {
$ref = addslashes(strip_tags(isset($vals['err_referer']) ? $vals['err_referer'] : ''));
// Uncomment the next two lines to create a separate CSV format log of invalid accesses - error code, entered URL, referrer
// $log_string = $err_code.",".$self.",".$ref;
// $logfp = fopen(e_LOG."errpages.csv", 'a+'); fwrite($logfp, $log_string."\n\r"); fclose($logfp);
$err_code .= ':';
}
if (strstr($ref, 'admin')) {
$ref = FALSE;
}
$screenstats = $res . '@' . $colour;
$agent = $_SERVER['HTTP_USER_AGENT'];
$ip = e107::getIPHandler()->ipDecode(USERIP);
$oldref = $ref;
// backup for search string being stripped off for referer
if ($ref && !strstr($ref, $_SERVER['HTTP_HOST'])) {
if (preg_match("#http://(.*?)(\$|/)#is", $ref, $match)) {
$ref = $match[0];
}
}
$pageDisallow = "cache|file|eself|admin";
$tagRemove = "(\\\\)|(\\s)|(\\')|(\")|(eself)|( )|(\\.php)|(\\.html)";
$tagRemove2 = "(\\\\)|(\\s)|(\\')|(\")|(eself)|( )";
/*
function logGetPageKey($url,$logQry=false,$err_code='')
{
global $pageDisallow, $tagRemove;