1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Приведение ajax параметров к одному стилю

* В процессе
This commit is contained in:
Denis Shakhov 2015-01-27 20:51:02 +07:00
parent 405a1c858e
commit a7a4faf0b6
7 changed files with 76 additions and 86 deletions

View file

@ -1776,7 +1776,7 @@ class ActionAjax extends Action
/**
* Комментарий существует?
*/
$idComment = getRequestStr('idComment', null, 'post');
$idComment = getRequestStr('comment_id', null, 'post');
if (!($oComment = $this->Comment_GetCommentById($idComment))) {
return $this->EventErrorDebug();
}
@ -1808,8 +1808,8 @@ class ActionAjax extends Action
* Показываем сообщение и передаем переменные в ajax ответ
*/
$this->Message_AddNoticeSingle($sMsg, $this->Lang_Get('attention'));
$this->Viewer_AssignAjax('bState', $bState);
$this->Viewer_AssignAjax('sTextToggle', $sTextToggle);
$this->Viewer_AssignAjax('state', $bState);
$this->Viewer_AssignAjax('toggle_text', $sTextToggle);
}
/**
@ -1821,7 +1821,7 @@ class ActionAjax extends Action
/**
* Комментарий существует?
*/
$idComment = getRequestStr('idComment', null, 'post');
$idComment = getRequestStr('comment_id', null, 'post');
if (!($oComment = $this->Comment_GetCommentById($idComment))) {
return $this->EventErrorDebug();
}
@ -1830,7 +1830,7 @@ class ActionAjax extends Action
return;
}
$sText = $oComment->getTextSource() ? $oComment->getTextSource() : $oComment->getText();
$this->Viewer_AssignAjax('sText', $sText);
$this->Viewer_AssignAjax('text', $sText);
}
/**
@ -1880,7 +1880,7 @@ class ActionAjax extends Action
$oViewerLocal->Assign('comment', $oComment, true);
$sHtml = $oViewerLocal->Fetch($this->Comment_GetTemplateCommentByTarget($oComment->getTargetId(),
$oComment->getTargetType()));
$this->Viewer_AssignAjax('sHtml', $sHtml);
$this->Viewer_AssignAjax('html', $sHtml);
} else {
return $this->EventErrorDebug();
}

View file

@ -1168,7 +1168,7 @@ class ActionBlog extends Action
protected function SubmitComment()
{
$oTopic = $this->Topic_GetTopicById(getRequestStr('cmt_target_id'));
$oTopic = $this->Topic_GetTopicById(getRequestStr('comment_target_id'));
$sText = getRequestStr('comment_text');
$sParentId = (int)getRequest('reply');
$oCommentParent = null;
@ -1298,7 +1298,7 @@ class ActionBlog extends Action
/**
* Топик существует?
*/
$idTopic = getRequestStr('idTarget', null, 'post');
$idTopic = getRequestStr('target_id', null, 'post');
if (!($oTopic = $this->Topic_GetTopicById($idTopic))) {
return $this->EventErrorDebug();
}
@ -1309,13 +1309,13 @@ class ActionBlog extends Action
return $this->EventErrorDebug();
}
$idCommentLast = getRequestStr('idCommentLast', null, 'post');
$selfIdComment = getRequestStr('selfIdComment', null, 'post');
$idCommentLast = getRequestStr('last_comment_id', null, 'post');
$selfIdComment = getRequestStr('self_comment_id', null, 'post');
$aComments = array();
/**
* Если используется постраничность, возвращаем только добавленный комментарий
*/
if (getRequest('bUsePaging', null, 'post') and $selfIdComment) {
if (getRequest('use_paging', null, 'post') and $selfIdComment) {
if ($oComment = $this->Comment_GetCommentById($selfIdComment) and $oComment->getTargetId() == $oTopic->getId() and $oComment->getTargetType() == 'topic') {
$oViewerLocal = $this->Viewer_GetLocalViewer();
@ -1354,15 +1354,15 @@ class ActionBlog extends Action
if ($aCmts and is_array($aCmts)) {
foreach ($aCmts as $aCmt) {
$aComments[] = array(
'html' => $aCmt['html'],
'idParent' => $aCmt['obj']->getPid(),
'id' => $aCmt['obj']->getId(),
'html' => $aCmt['html'],
'parent_id' => $aCmt['obj']->getPid(),
'id' => $aCmt['obj']->getId(),
);
}
}
$this->Viewer_AssignAjax('iMaxIdComment', $iMaxIdComment);
$this->Viewer_AssignAjax('aComments', $aComments);
$this->Viewer_AssignAjax('last_comment_id', $iMaxIdComment);
$this->Viewer_AssignAjax('comments', $aComments);
}
/**
@ -1375,8 +1375,8 @@ class ActionBlog extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$aUsers = getRequest('aUserList', null, 'post');
$sBlogId = getRequestStr('iTargetId', null, 'post');
$aUsers = getRequest('users', null, 'post');
$sBlogId = getRequestStr('target_id', null, 'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -1425,7 +1425,7 @@ class ActionBlog extends Action
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $this->Lang_Get('user.notices.not_found',
array('login' => htmlspecialchars($sUser))),
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
continue;
}
@ -1460,11 +1460,9 @@ class ActionBlog extends Action
'sMsgTitle' => $this->Lang_Get('attention'),
'sMsg' => $this->Lang_Get('blog.invite.notices.add',
array('login' => htmlspecialchars($sUser))),
'sUserLogin' => htmlspecialchars($sUser),
'sUserWebPath' => $oUser->getUserWebPath(),
'sUserAvatar48' => $oUser->getProfileAvatarPath(48),
'iUserId' => $oUser->getId(),
'sHtml' => $oViewer->Fetch("components/blog/invite/invite-item.tpl")
'user_id' => $oUser->getId(),
'user_login' => htmlspecialchars($sUser),
'html' => $oViewer->Fetch("components/blog/invite/invite-item.tpl")
);
$this->SendBlogInvite($oBlog, $oUser);
} else {
@ -1472,7 +1470,7 @@ class ActionBlog extends Action
'bStateError' => true,
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $this->Lang_Get('system_error'),
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
}
} else {
@ -1500,7 +1498,7 @@ class ActionBlog extends Action
'bStateError' => true,
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $sErrorMessage,
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
continue;
}
@ -1508,7 +1506,7 @@ class ActionBlog extends Action
/**
* Передаем во вьевер массив с результатами обработки по каждому пользователю
*/
$this->Viewer_AssignAjax('aUserList', $aResult);
$this->Viewer_AssignAjax('users', $aResult);
}
/**
@ -1521,8 +1519,8 @@ class ActionBlog extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUserId = getRequestStr('iUserId', null, 'post');
$sBlogId = getRequestStr('iTargetId', null, 'post');
$sUserId = getRequestStr('user_id', null, 'post');
$sBlogId = getRequestStr('target_id', null, 'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -1575,8 +1573,8 @@ class ActionBlog extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUserId = getRequestStr('iUserId', null, 'post');
$sBlogId = getRequestStr('iTargetId', null, 'post');
$sUserId = getRequestStr('user_id', null, 'post');
$sBlogId = getRequestStr('target_id', null, 'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/

View file

@ -93,8 +93,8 @@ class ActionBlogs extends Action
'blog_count_user',
'blog_count_topic'
)) ? getRequestStr('sort_by') : 'blog_count_user';
if (is_numeric(getRequestStr('pageNext')) and getRequestStr('pageNext') > 0) {
$iPage = getRequestStr('pageNext');
if (is_numeric(getRequestStr('next_page')) and getRequestStr('next_page') > 0) {
$iPage = getRequestStr('next_page');
} else {
$iPage = 1;
}
@ -152,13 +152,13 @@ class ActionBlogs extends Action
$oViewer->Assign('useMore', true, true);
$oViewer->Assign('hideMore', $bHideMore, true);
$oViewer->Assign('searchCount', $aResult['count'], true);
$this->Viewer_AssignAjax('sText', $oViewer->Fetch("components/blog/blog-list.tpl"));
$this->Viewer_AssignAjax('html', $oViewer->Fetch("components/blog/blog-list.tpl"));
/**
* Для подгрузки
*/
$this->Viewer_AssignAjax('count_loaded', count($aResult['collection']));
$this->Viewer_AssignAjax('pageNext', count($aResult['collection']) > 0 ? $iPage + 1 : $iPage);
$this->Viewer_AssignAjax('bHideMore', $bHideMore);
$this->Viewer_AssignAjax('next_page', count($aResult['collection']) > 0 ? $iPage + 1 : $iPage);
$this->Viewer_AssignAjax('hide', $bHideMore);
}
/**

View file

@ -90,8 +90,8 @@ class ActionPeople extends Action
'user_login',
'user_profile_name'
)) ? getRequestStr('sort_by') : 'user_rating';
if (is_numeric(getRequestStr('pageNext')) and getRequestStr('pageNext') > 0) {
$iPage = getRequestStr('pageNext');
if (is_numeric(getRequestStr('next_page')) and getRequestStr('next_page') > 0) {
$iPage = getRequestStr('next_page');
} else {
$iPage = 1;
}
@ -158,13 +158,13 @@ class ActionPeople extends Action
$oViewer->Assign('useMore', true, true);
$oViewer->Assign('hideMore', $bHideMore, true);
$oViewer->Assign('searchCount', $aResult['count'], true);
$this->Viewer_AssignAjax('sText', $oViewer->Fetch("components/user/user-list.tpl"));
$this->Viewer_AssignAjax('html', $oViewer->Fetch("components/user/user-list.tpl"));
/**
* Для подгрузки
*/
$this->Viewer_AssignAjax('count_loaded', count($aResult['collection']));
$this->Viewer_AssignAjax('pageNext', count($aResult['collection']) > 0 ? $iPage + 1 : $iPage);
$this->Viewer_AssignAjax('bHideMore', $bHideMore);
$this->Viewer_AssignAjax('next_page', count($aResult['collection']) > 0 ? $iPage + 1 : $iPage);
$this->Viewer_AssignAjax('hide', $bHideMore);
}
/**

View file

@ -253,7 +253,7 @@ class ActionStream extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$aUsers = getRequest('aUserList', null, 'post');
$aUsers = getRequest('users', null, 'post');
/**
* Валидация
@ -293,11 +293,9 @@ class ActionStream extends Action
'sMsgTitle' => $this->Lang_Get('attention'),
'sMsg' => $this->Lang_Get('common.success.add',
array('login' => htmlspecialchars($sUser))),
'sUserId' => $oUser->getId(),
'sUserLogin' => htmlspecialchars($sUser),
'sUserWebPath' => $oUser->getUserWebPath(),
'sUserAvatar48' => $oUser->getProfileAvatarPath(48),
'sHtml' => $oViewer->Fetch("components/user-list-add/item.tpl")
'user_id' => $oUser->getId(),
'user_login' => htmlspecialchars($sUser),
'html' => $oViewer->Fetch("components/user-list-add/item.tpl")
);
} else {
$aResult[] = array(
@ -305,14 +303,14 @@ class ActionStream extends Action
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $this->Lang_Get('user.notices.not_found',
array('login' => htmlspecialchars($sUser))),
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
}
}
/**
* Передаем во вьевер массив с результатами обработки по каждому пользователю
*/
$this->Viewer_AssignAjax('aUserList', $aResult);
$this->Viewer_AssignAjax('users', $aResult);
}
/**
@ -320,6 +318,7 @@ class ActionStream extends Action
*/
protected function EventAjaxRemoveUser()
{
$iUserId = (int) getRequestStr('user_id');
/**
* Устанавливаем формат Ajax ответа
*/
@ -333,14 +332,14 @@ class ActionStream extends Action
/**
* Пользователь с таким ID существует?
*/
if (!$this->User_GetUserById(getRequestStr('iUserId'))) {
if (!$this->User_GetUserById($iUserId)) {
return $this->EventErrorDebug();
}
/**
* Отписываем
*/
$this->Stream_unsubscribeUser($this->oUserCurrent->getId(), getRequestStr('iUserId'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
$this->Stream_unsubscribeUser($this->oUserCurrent->getId(), $iUserId);
$this->Message_AddNotice($this->Lang_Get('common.success.remove'), $this->Lang_Get('attention'));
}
/**

View file

@ -781,7 +781,7 @@ class ActionTalk extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$aUsers = getRequest('aUserList', null, 'post');
$aUsers = getRequest('users', null, 'post');
/**
* Валидация
@ -837,18 +837,16 @@ class ActionTalk extends Action
'sMsgTitle' => $this->Lang_Get('attention'),
'sMsg' => $this->Lang_Get('common.success.add',
array('login' => htmlspecialchars($sUser))),
'sUserId' => $oUser->getId(),
'sUserLogin' => htmlspecialchars($sUser),
'sUserWebPath' => $oUser->getUserWebPath(),
'sUserAvatar48' => $oUser->getProfileAvatarPath(48),
'sHtml' => $oViewer->Fetch("components/user/user-list-add/item.tpl")
'user_id' => $oUser->getId(),
'user_login' => htmlspecialchars($sUser),
'html' => $oViewer->Fetch("components/user/user-list-add/item.tpl")
);
} else {
$aResult[] = array(
'bStateError' => true,
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $this->Lang_Get('system_error'),
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
}
} else {
@ -860,7 +858,7 @@ class ActionTalk extends Action
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $this->Lang_Get('user_list_add.notices.error_already_added',
array('login' => htmlspecialchars($sUser))),
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
continue;
}
@ -870,14 +868,14 @@ class ActionTalk extends Action
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $this->Lang_Get('user.notices.not_found',
array('login' => htmlspecialchars($sUser))),
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
}
}
/**
* Передаем во вьевер массив с результатами обработки по каждому пользователю
*/
$this->Viewer_AssignAjax('aUserList', $aResult);
$this->Viewer_AssignAjax('users', $aResult);
}
/**
@ -890,7 +888,7 @@ class ActionTalk extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$iUserId = getRequestStr('iUserId', null, 'post');
$iUserId = getRequestStr('user_id', null, 'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -953,8 +951,8 @@ class ActionTalk extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$iUserId = getRequestStr('iUserId', null, 'post');
$iTalkId = getRequestStr('iTargetId', null, 'post');
$iUserId = getRequestStr('user_id', null, 'post');
$iTalkId = getRequestStr('target_id', null, 'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -1031,8 +1029,8 @@ class ActionTalk extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$aUsers = getRequest('aUserList', null, 'post');
$idTalk = getRequestStr('iTargetId', null, 'post');
$aUsers = getRequest('users', null, 'post');
$idTalk = getRequestStr('target_id', null, 'post');
/**
* Валидация
*/
@ -1128,12 +1126,9 @@ class ActionTalk extends Action
'sMsgTitle' => $this->Lang_Get('attention'),
'sMsg' => $this->Lang_Get('user_list_add.notices.success_add',
array('login', htmlspecialchars($sUser))),
'iUserId' => $oUser->getId(),
'sUserLogin' => $oUser->getLogin(),
'sUserLink' => $oUser->getUserWebPath(),
'sUserWebPath' => $oUser->getUserWebPath(),
'sUserAvatar48' => $oUser->getProfileAvatarPath(48),
'sHtml' => $oViewer->Fetch("components/talk/participants/participants-item.tpl")
'user_id' => $oUser->getId(),
'user_login' => $oUser->getLogin(),
'html' => $oViewer->Fetch("components/talk/participants/participants-item.tpl")
);
$bState = true;
} else {
@ -1197,8 +1192,8 @@ class ActionTalk extends Action
'sMsgTitle' => $this->Lang_Get('attention'),
'sMsg' => $this->Lang_Get('user_list_add.notices.success_add',
array('login', htmlspecialchars($sUser))),
'iUserId' => $oUser->getId(),
'sHtml' => $oViewer->Fetch("components/talk/participants/participants-item.tpl")
'user_id' => $oUser->getId(),
'html' => $oViewer->Fetch("components/talk/participants/participants-item.tpl")
);
$bState = true;
} else {
@ -1234,7 +1229,7 @@ class ActionTalk extends Action
/**
* Передаем во вьевер массив результатов обработки по каждому пользователю
*/
$this->Viewer_AssignAjax('aUserList', $aResult);
$this->Viewer_AssignAjax('users', $aResult);
}
/**

View file

@ -160,7 +160,7 @@ class ActionUserfeed extends Action
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$aUsers = getRequest('aUserList', null, 'post');
$aUsers = getRequest('users', null, 'post');
/**
* Валидация
*/
@ -200,11 +200,9 @@ class ActionUserfeed extends Action
'sMsgTitle' => $this->Lang_Get('attention'),
'sMsg' => $this->Lang_Get('common.success.add',
array('login' => htmlspecialchars($sUser))),
'sUserId' => $oUser->getId(),
'sUserLogin' => htmlspecialchars($sUser),
'sUserWebPath' => $oUser->getUserWebPath(),
'sUserAvatar48' => $oUser->getProfileAvatarPath(48),
'sHtml' => $oViewer->Fetch("components/user-list-add/item.tpl")
'user_id' => $oUser->getId(),
'user_login' => htmlspecialchars($sUser),
'html' => $oViewer->Fetch("components/user-list-add/item.tpl")
);
} else {
$aResult[] = array(
@ -212,14 +210,14 @@ class ActionUserfeed extends Action
'sMsgTitle' => $this->Lang_Get('error'),
'sMsg' => $this->Lang_Get('user.notices.not_found',
array('login' => htmlspecialchars($sUser))),
'sUserLogin' => htmlspecialchars($sUser)
'user_login' => htmlspecialchars($sUser)
);
}
}
/**
* Передаем во вьевер массив с результатами обработки по каждому пользователю
*/
$this->Viewer_AssignAjax('aUserList', $aResult);
$this->Viewer_AssignAjax('users', $aResult);
}
/**
@ -245,7 +243,7 @@ class ActionUserfeed extends Action
break;
case 'users':
$iType = ModuleUserfeed::SUBSCRIBE_TYPE_USER;
$sId = getRequestStr('iUserId');
$sId = getRequestStr('user_id');
break;
default:
$this->Message_AddError($this->Lang_Get('system_error'), $this->Lang_Get('error'));
@ -259,7 +257,7 @@ class ActionUserfeed extends Action
* Отписываем пользователя
*/
$this->Userfeed_unsubscribeUser($this->oUserCurrent->getId(), $iType, $sId);
$this->Message_AddNotice($this->Lang_Get('common.success.save'), $this->Lang_Get('attention'));
$this->Message_AddNotice($this->Lang_Get('common.success.remove'), $this->Lang_Get('attention'));
}
/**