From a50e73be745ce161af3e58b3ac4dde3de6a299cd Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Sat, 3 Apr 2010 20:38:00 +0000 Subject: [PATCH] =?UTF-8?q?fix=20=D0=BF=D1=80=D0=B8=D0=B3=D0=BB=D0=B0?= =?UTF-8?q?=D1=88=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=B7=D0=B0=D0=BA?= =?UTF-8?q?=D1=80=D1=8B=D1=82=D1=8B=D0=B9=20=D0=B1=D0=BB=D0=BE=D0=B3=20+?= =?UTF-8?q?=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BF=D0=BE=D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D0=B3=D0=BB=D0=B0=D1=88=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?+=20fix=20for=20PHP5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/actions/ActionBlog.class.php | 55 ++++++++++++++++++- classes/actions/ActionProfile.class.php | 7 ++- .../libs/plugins/function.fetch.php | 4 +- .../external/phpMailer/class.phpmailer.php | 4 +- templates/language/russian.php | 1 + .../skin/new/actions/ActionBlog/invited.tpl | 23 +++++++- templates/skin/new/css/style.css | 3 +- 7 files changed, 85 insertions(+), 12 deletions(-) diff --git a/classes/actions/ActionBlog.class.php b/classes/actions/ActionBlog.class.php index e5e18569..c13bf709 100644 --- a/classes/actions/ActionBlog.class.php +++ b/classes/actions/ActionBlog.class.php @@ -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); diff --git a/classes/actions/ActionProfile.class.php b/classes/actions/ActionProfile.class.php index 056cc2d0..b0cc06f8 100644 --- a/classes/actions/ActionProfile.class.php +++ b/classes/actions/ActionProfile.class.php @@ -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, diff --git a/engine/lib/external/Smarty-2.6.19/libs/plugins/function.fetch.php b/engine/lib/external/Smarty-2.6.19/libs/plugins/function.fetch.php index 81b1bfc6..8b36ce3c 100644 --- a/engine/lib/external/Smarty-2.6.19/libs/plugins/function.fetch.php +++ b/engine/lib/external/Smarty-2.6.19/libs/plugins/function.fetch.php @@ -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 { diff --git a/engine/lib/external/phpMailer/class.phpmailer.php b/engine/lib/external/phpMailer/class.phpmailer.php index 51a50e78..58f52ddd 100644 --- a/engine/lib/external/phpMailer/class.phpmailer.php +++ b/engine/lib/external/phpMailer/class.phpmailer.php @@ -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 .= '/'; } diff --git a/templates/language/russian.php b/templates/language/russian.php index d49f4991..91222c64 100644 --- a/templates/language/russian.php +++ b/templates/language/russian.php @@ -167,6 +167,7 @@ return array( 'blog_user_invite_already_done' => 'Вы уже являетесь пользователем этого блога', 'blog_user_invite_accept' => 'Приглашение принято', 'blog_user_invite_reject' => 'Приглашение отклонено', + 'blog_user_invite_readd' => 'повторить', /** * Топики diff --git a/templates/skin/new/actions/ActionBlog/invited.tpl b/templates/skin/new/actions/ActionBlog/invited.tpl index 380bab8f..70ddb4c8 100644 --- a/templates/skin/new/actions/ActionBlog/invited.tpl +++ b/templates/skin/new/actions/ActionBlog/invited.tpl @@ -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 @@ {/if} diff --git a/templates/skin/new/css/style.css b/templates/skin/new/css/style.css index d3a14a7a..6c6167a5 100644 --- a/templates/skin/new/css/style.css +++ b/templates/skin/new/css/style.css @@ -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; }