-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_nick.addon.php
38 lines (33 loc) · 1.13 KB
/
auto_nick.addon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/* Copyright (C) Xvezda <http://xvezda.blog.me> */
if(!defined('__XE__'))
{
exit();
}
/**
* @file auto_nick.addon.php
* @author Xvezda (xvezda@naver.com)
* @brief Add-on to auto input guest nickname
*/
if($called_position == 'after_module_proc' && Context::get('module') != 'admin' && (Context::getResponseMethod() == 'HTML' || !isCrawler()))
{
if(Context::get('logged_info')) return;
if(Context::get('act') == 'dispMemberSignUpForm') return;
if(in_array(Context::get('act'), array('procBoardInsertDocument', 'procBoardInsertComment')))
{
setcookie('auto_nick', urlencode(Context::get('nick_name')), $_SERVER['REQUEST_TIME'] + 31536000, '/');
}
if($_COOKIE['auto_nick'])
{
if(Mobile::isFromMobilePhone())
{
Context::addHtmlFooter('<script>jQuery("input[name=nick_name]").val(decodeURIComponent("'.htmlentities($_COOKIE['auto_nick']).'"));</script>');
}
else
{
Context::addHtmlFooter('<script>jQuery("input[name=nick_name]").focus().val(decodeURIComponent("'.htmlentities($_COOKIE['auto_nick']).'"));</script>');
}
}
}
/* End of file auto_nick.addon.php */
/* Location: ./addons/auto_nick/auto_nick.addon.php */