mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-17 07:10:48 +03:00
fix приглашения в закрытый блог + возможность повторно отправить приглашение + fix for PHP5
This commit is contained in:
parent
d74a4da661
commit
a50e73be74
|
@ -124,6 +124,7 @@ class ActionBlog extends Action {
|
|||
|
||||
$this->AddEvent('ajaxaddcomment','AjaxAddComment');
|
||||
$this->AddEvent('ajaxaddbloginvite', 'AjaxAddBlogInvite');
|
||||
$this->AddEvent('ajaxrebloginvite', 'AjaxReBlogInvite');
|
||||
|
||||
$this->AddEventPreg('/^(\d+)\.html$/i','/^$/i','EventShowTopic');
|
||||
$this->AddEventPreg('/^[\w\-\_]+$/i','/^(\d+)\.html$/i','EventShowTopic');
|
||||
|
@ -1076,6 +1077,52 @@ class ActionBlog extends Action {
|
|||
$this->Viewer_AssignAjax('aUsers',$aResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* Обработка ajax запроса на отправку
|
||||
* повторного приглашения вступить в закрытый блог
|
||||
*/
|
||||
protected function AjaxReBlogInvite() {
|
||||
$this->Viewer_SetResponseAjax();
|
||||
$sUserId=getRequest('idUser',null,'post');
|
||||
$sBlogId=getRequest('idBlog',null,'post');
|
||||
|
||||
/**
|
||||
* Если пользователь не авторизирован, возвращаем ошибку
|
||||
*/
|
||||
if (!$this->User_IsAuthorization()) {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('need_authorization'),$this->Lang_Get('error'));
|
||||
return;
|
||||
}
|
||||
$this->oUserCurrent=$this->User_GetUserCurrent();
|
||||
/**
|
||||
* Проверяем существование блога
|
||||
*/
|
||||
if(!$oBlog=$this->Blog_GetBlogById($sBlogId)) {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
}
|
||||
if (!$oUser=$this->User_GetUserById($sUserId) or $oUser->getActivate()!=1) {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Проверяем, имеет ли право текущий пользователь добавлять invite в blog
|
||||
*/
|
||||
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId());
|
||||
$bIsAdministratorBlog=$oBlogUser ? $oBlogUser->getIsAdministrator() : false;
|
||||
if ($oBlog->getOwnerId()!=$this->oUserCurrent->getId() and !$this->oUserCurrent->isAdministrator() and !$bIsAdministratorBlog) {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
return;
|
||||
}
|
||||
|
||||
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oBlog->getId(),$oUser->getId());
|
||||
if ($oBlogUser->getUserRole()==LsBlog::BLOG_USER_ROLE_INVITE) {
|
||||
$this->SendBlogInvite($oBlog,$oUser);
|
||||
$this->Message_AddNoticeSingle($this->Lang_Get('blog_user_invite_add_ok',array('login'=>$oUser->getLogin())),$this->Lang_Get('attention'));
|
||||
} else {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Выполняет отправку приглашения в блог
|
||||
* (по внутренней почте и на email)
|
||||
|
@ -1093,7 +1140,7 @@ class ActionBlog extends Action {
|
|||
|
||||
require_once Config::Get('path.root.engine').'/lib/external/XXTEA/encrypt.php';
|
||||
$sCode=$oBlog->getId().'_'.$oUser->getId();
|
||||
$sCode=urlencode(xxtea_encrypt($sCode, Config::Get('module.blog.encrypt')));
|
||||
$sCode=rawurlencode(base64_encode(xxtea_encrypt($sCode, Config::Get('module.blog.encrypt'))));
|
||||
|
||||
$aPath=array(
|
||||
'accept'=>Router::GetPath('blog').'invite/accept/?code='.$sCode,
|
||||
|
@ -1128,8 +1175,12 @@ class ActionBlog extends Action {
|
|||
*/
|
||||
protected function EventInviteBlog() {
|
||||
require_once Config::Get('path.root.engine').'/lib/external/XXTEA/encrypt.php';
|
||||
$sCode=xxtea_decrypt(urldecode(getRequest('code')), Config::Get('module.blog.encrypt'));
|
||||
$sCode=xxtea_decrypt(base64_decode(rawurldecode(getRequest('code'))), Config::Get('module.blog.encrypt'));
|
||||
|
||||
if (!$sCode) {
|
||||
return $this->EventNotFound();
|
||||
}
|
||||
|
||||
list($sBlogId,$sUserId)=explode('_',$sCode,2);
|
||||
|
||||
$sAction=$this->GetParam(0);
|
||||
|
|
|
@ -198,7 +198,10 @@ class ActionProfile extends Action {
|
|||
*/
|
||||
public function EventFriendOffer() {
|
||||
require_once Config::Get('path.root.engine').'/lib/external/XXTEA/encrypt.php';
|
||||
$sUserId=xxtea_decrypt(base64_decode(getRequest('code')), Config::Get('module.talk.encrypt'));
|
||||
$sUserId=xxtea_decrypt(base64_decode(rawurldecode(getRequest('code'))), Config::Get('module.talk.encrypt'));
|
||||
if (!$sUserId) {
|
||||
return $this->EventNotFound();
|
||||
}
|
||||
list($sUserId,)=explode('_',$sUserId,2);
|
||||
|
||||
$sAction=$this->GetParam(0);
|
||||
|
@ -541,7 +544,7 @@ class ActionProfile extends Action {
|
|||
|
||||
require_once Config::Get('path.root.engine').'/lib/external/XXTEA/encrypt.php';
|
||||
$sCode=$this->oUserCurrent->getId().'_'.$oUser->getId();
|
||||
$sCode=urlencode(base64_encode(xxtea_encrypt($sCode, Config::Get('module.talk.encrypt'))));
|
||||
$sCode=rawurlencode(base64_encode(xxtea_encrypt($sCode, Config::Get('module.talk.encrypt'))));
|
||||
|
||||
$aPath=array(
|
||||
'accept'=>Router::GetPath('profile').'friendoffer/accept/?code='.$sCode,
|
||||
|
|
|
@ -181,12 +181,12 @@ function smarty_function_fetch($params, &$smarty)
|
|||
$content .= fgets($fp,4096);
|
||||
}
|
||||
fclose($fp);
|
||||
$csplit = split("\r\n\r\n",$content,2);
|
||||
$csplit = explode("\r\n\r\n",$content,2);
|
||||
|
||||
$content = $csplit[1];
|
||||
|
||||
if(!empty($params['assign_headers'])) {
|
||||
$smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
|
||||
$smarty->assign($params['assign_headers'],explode("\r\n",$csplit[0]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -469,7 +469,7 @@ class PHPMailer {
|
|||
$to .= $this->AddrFormat($this->to[$i]);
|
||||
}
|
||||
|
||||
$toArr = split(',', $to);
|
||||
$toArr = explode(',', $to);
|
||||
|
||||
$params = sprintf("-oi -f %s", $this->Sender);
|
||||
if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
|
||||
|
@ -1707,7 +1707,7 @@ class PHPMailer {
|
|||
$directory = dirname($url);
|
||||
($directory == '.')?$directory='':'';
|
||||
$cid = 'cid:' . md5($filename);
|
||||
$fileParts = split("\.", $filename);
|
||||
$fileParts = explode(".", $filename);
|
||||
$ext = $fileParts[1];
|
||||
$mimeType = $this->_mime_types($ext);
|
||||
if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
|
||||
|
|
|
@ -167,6 +167,7 @@ return array(
|
|||
'blog_user_invite_already_done' => 'Вы уже являетесь пользователем этого блога',
|
||||
'blog_user_invite_accept' => 'Приглашение принято',
|
||||
'blog_user_invite_reject' => 'Приглашение отклонено',
|
||||
'blog_user_invite_readd' => 'повторить',
|
||||
|
||||
/**
|
||||
* Топики
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
|
||||
function addBlogInvite(idBlog) {
|
||||
sUsers=$('blog_admin_user_add').get('value');
|
||||
if(sUsers.length<2) {
|
||||
msgErrorBox.alert('Error','Пользователь не указан');
|
||||
if(!sUsers) {
|
||||
return false;
|
||||
}
|
||||
$('blog_admin_user_add').set('value','');
|
||||
|
@ -56,6 +55,24 @@
|
|||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
return false;
|
||||
}
|
||||
function reBlogInvite(idUser,idBlog) {
|
||||
JsHttpRequest.query(
|
||||
'POST '+aRouter['blog']+'ajaxrebloginvite/',
|
||||
{ idUser: idUser, idBlog: idBlog, security_ls_key: LIVESTREET_SECURITY_KEY },
|
||||
function(result, errors) {
|
||||
if (!result) {
|
||||
msgErrorBox.alert('Error','Please try again later');
|
||||
}
|
||||
if (result.bStateError) {
|
||||
msgErrorBox.alert(result.sMsgTitle,result.sMsg);
|
||||
} else {
|
||||
msgNoticeBox.alert(result.sMsgTitle, result.sMsg);
|
||||
}
|
||||
},
|
||||
true
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -74,7 +91,7 @@
|
|||
<ul class="list" id="invited_list">
|
||||
{foreach from=$aBlogUsersInvited item=oBlogUser}
|
||||
{assign var='oUser' value=$oBlogUser->getUser()}
|
||||
<li><span class="user"><a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a></span></li>
|
||||
<li><span class="user"><a href="{$oUser->getUserWebPath()}">{$oUser->getLogin()}</a></span> — <a href="#" class="local" onclick="return reBlogInvite({$oUser->getId()},{$oBlogEdit->getId()});">{$aLang.blog_user_invite_readd}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
|
|
@ -338,7 +338,8 @@ select { width: 99%; }
|
|||
|
||||
.block.blogs ul.list { border-top: 1px solid #eee; padding-top: 3px; margin-top: 10px; }
|
||||
.block.blogs ul.list li { overflow: hidden; border-bottom: 1px solid #eee; padding-bottom: 5px; margin-bottom: 5px; }
|
||||
.block.blogs ul.list li a { padding-right: 50px; color: #777; }
|
||||
.block.blogs ul.list li a { color: #777; }
|
||||
.block.blogs ul.list li a.local { text-decoration: none; border-bottom: 1px dotted #777;}
|
||||
.block.blogs ul.list li a.close { padding-right: 20px; background: url(../images/key.png) no-repeat right; }
|
||||
.block.blogs ul.list li .total { float: right; font-weight: bold; padding-right: 13px; }
|
||||
.block.blogs ul.list li .up { background: url(../images/blog-rating-up.gif) no-repeat right 5px; }
|
||||
|
|
Loading…
Reference in a new issue