1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00
This commit is contained in:
Mzhelskiy Maxim 2012-07-08 12:50:36 +04:00
parent 4adbac6512
commit addd78ebee
16 changed files with 77 additions and 38 deletions

View file

@ -93,6 +93,10 @@ class ActionAjax extends Action {
/**
* Если блог существует и он не персональный
*/
if (!is_string(getRequest('iBlogId'))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));
return;
}
if (!($oBlog=$this->Blog_GetBlogById(getRequest('iBlogId'))) or $oBlog->getType()=='personal') {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));
return;
@ -596,7 +600,7 @@ class ActionAjax extends Action {
/**
* Обрабатываем теги
*/
$aTags=explode(',',trim(getRequest('tags'),"\r\n\t\0\x0B ."));
$aTags=explode(',',trim((string)getRequest('tags'),"\r\n\t\0\x0B ."));
$aTagsNew=array();
$aTagsNewLow=array();
$aTagsReturn=array();
@ -1019,7 +1023,7 @@ class ActionAjax extends Action {
*
*/
protected function EventPreviewText() {
$sText=getRequest('text',null,'post');
$sText=(string)getRequest('text',null,'post');
$bSave=getRequest('save',null,'post');
/**
* Экранировать или нет HTML теги
@ -1104,7 +1108,7 @@ class ActionAjax extends Action {
/**
* Первые буквы тега переданы?
*/
if (!($sValue=getRequest('value',null,'post'))) {
if (!($sValue=getRequest('value',null,'post')) or !is_string($sValue)) {
return ;
}
$aItems=array();
@ -1128,7 +1132,7 @@ class ActionAjax extends Action {
/**
* Первые буквы логина переданы?
*/
if (!($sValue=getRequest('value',null,'post'))) {
if (!($sValue=getRequest('value',null,'post')) or !is_string($sValue)) {
return ;
}
$aItems=array();

View file

@ -207,7 +207,7 @@ class ActionBlog extends Action {
$oBlog->setType(getRequest('blog_type'));
$oBlog->setDateAdd(date("Y-m-d H:i:s"));
$oBlog->setLimitRatingTopic(getRequest('blog_limit_rating_topic'));
$oBlog->setUrl(getRequest('blog_url'));
$oBlog->setUrl((string)getRequest('blog_url'));
$oBlog->setAvatar(null);
/**
* Загрузка аватара, делаем ресайзы
@ -315,7 +315,7 @@ class ActionBlog extends Action {
$oBlog->setType(getRequest('blog_type'));
$oBlog->setLimitRatingTopic(getRequest('blog_limit_rating_topic'));
if ($this->oUserCurrent->isAdministrator()) {
$oBlog->setUrl(getRequest('blog_url')); // разрешаем смену URL блога только админу
$oBlog->setUrl((string)getRequest('blog_url')); // разрешаем смену URL блога только админу
}
/**
* Загрузка аватара, делаем ресайзы
@ -501,21 +501,23 @@ class ActionBlog extends Action {
if (!func_check(getRequest('blog_title'),'text',2,200)) {
$this->Message_AddError($this->Lang_Get('blog_create_title_error'),$this->Lang_Get('error'));
$bOk=false;
}
/**
* Проверяем есть ли уже блог с таким названием
*/
if ($oBlogExists=$this->Blog_GetBlogByTitle(getRequest('blog_title'))) {
if (!$oBlog or $oBlog->getId()!=$oBlogExists->getId()) {
$this->Message_AddError($this->Lang_Get('blog_create_title_error_unique'),$this->Lang_Get('error'));
$bOk=false;
} else {
/**
* Проверяем есть ли уже блог с таким названием
*/
if ($oBlogExists=$this->Blog_GetBlogByTitle(getRequest('blog_title'))) {
if (!$oBlog or $oBlog->getId()!=$oBlogExists->getId()) {
$this->Message_AddError($this->Lang_Get('blog_create_title_error_unique'),$this->Lang_Get('error'));
$bOk=false;
}
}
}
/**
* Проверяем есть ли URL блога, с заменой всех пробельных символов на "_"
*/
if (!$oBlog or $this->oUserCurrent->isAdministrator()) {
$blogUrl=preg_replace("/\s+/",'_',getRequest('blog_url'));
$blogUrl=preg_replace("/\s+/",'_',(string)getRequest('blog_url'));
$_REQUEST['blog_url']=$blogUrl;
if (!func_check(getRequest('blog_url'),'login',2,50)) {
$this->Message_AddError($this->Lang_Get('blog_create_url_error'),$this->Lang_Get('error'));
@ -532,7 +534,7 @@ class ActionBlog extends Action {
/**
* Проверяем есть ли уже блог с таким URL
*/
if ($oBlogExists=$this->Blog_GetBlogByUrl(getRequest('blog_url'))) {
if ($oBlogExists=$this->Blog_GetBlogByUrl((string)getRequest('blog_url'))) {
if (!$oBlog or $oBlog->getId()!=$oBlogExists->getId()) {
$this->Message_AddError($this->Lang_Get('blog_create_url_error_unique'),$this->Lang_Get('error'));
$bOk=false;
@ -1200,7 +1202,7 @@ class ActionBlog extends Action {
/**
* Проверяем существование блога
*/
if(!$oBlog=$this->Blog_GetBlogById($sBlogId)) {
if(!$oBlog=$this->Blog_GetBlogById($sBlogId) or !is_string($sUsers)) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -1486,7 +1488,7 @@ class ActionBlog extends Action {
/**
* Получаем код подтверждения из ревеста и дешефруем его
*/
$sCode=xxtea_decrypt(base64_decode(rawurldecode(getRequest('code'))), Config::Get('module.blog.encrypt'));
$sCode=xxtea_decrypt(base64_decode(rawurldecode((string)getRequest('code'))), Config::Get('module.blog.encrypt'));
if (!$sCode) {
return $this->EventNotFound();
}

View file

@ -610,7 +610,7 @@ class ActionProfile extends Action {
$oNote=Engine::GetEntity('ModuleUser_EntityNote');
$oNote->setTargetUserId(getRequest('iUserId'));
$oNote->setUserId($this->oUserCurrent->getId());
$oNote->setText(getRequest('text'));
$oNote->setText((string)getRequest('text'));
if ($oNote->_Validate()) {
/**
@ -693,7 +693,7 @@ class ActionProfile extends Action {
/**
* Из реквеста дешефруем ID польователя
*/
$sUserId=xxtea_decrypt(base64_decode(rawurldecode(getRequest('code'))), Config::Get('module.talk.encrypt'));
$sUserId=xxtea_decrypt(base64_decode(rawurldecode((string)getRequest('code'))), Config::Get('module.talk.encrypt'));
if (!$sUserId) {
return $this->EventNotFound();
}

View file

@ -158,7 +158,10 @@ class ActionSettings extends Action {
*/
$aSize=array();
$aSizeTmp=getRequest('size');
if (isset($aSizeTmp['x']) and $aSizeTmp['x'] and isset($aSizeTmp['y']) and isset($aSizeTmp['x2']) and isset($aSizeTmp['y2'])) {
if (isset($aSizeTmp['x']) and is_numeric($aSizeTmp['x'])
and isset($aSizeTmp['y']) and is_numeric($aSizeTmp['y'])
and isset($aSizeTmp['x2']) and is_numeric($aSizeTmp['x2'])
and isset($aSizeTmp['y2']) and is_numeric($aSizeTmp['y2'])) {
$aSize=array('x1'=>round($fRation*$aSizeTmp['x']),'y1'=>round($fRation*$aSizeTmp['y']),'x2'=>round($fRation*$aSizeTmp['x2']),'y2'=>round($fRation*$aSizeTmp['y2']));
}
/**
@ -280,7 +283,10 @@ class ActionSettings extends Action {
*/
$aSize=array();
$aSizeTmp=getRequest('size');
if (isset($aSizeTmp['x']) and $aSizeTmp['x'] and isset($aSizeTmp['y']) and isset($aSizeTmp['x2']) and isset($aSizeTmp['y2'])) {
if (isset($aSizeTmp['x']) and is_numeric($aSizeTmp['x'])
and isset($aSizeTmp['y']) and is_numeric($aSizeTmp['y'])
and isset($aSizeTmp['x2']) and is_numeric($aSizeTmp['x2'])
and isset($aSizeTmp['y2']) and is_numeric($aSizeTmp['y2'])) {
$aSize=array('x1'=>$aSizeTmp['x'],'y1'=>$aSizeTmp['y'],'x2'=>$aSizeTmp['x2'],'y2'=>$aSizeTmp['y2']);
}
/**
@ -615,7 +621,7 @@ class ActionSettings extends Action {
$aData = array();
foreach ($aFields as $iId => $aField) {
if (isset($_REQUEST['profile_user_field_'.$iId])) {
$aData[$iId] = getRequest('profile_user_field_'.$iId);
$aData[$iId] = (string)getRequest('profile_user_field_'.$iId);
}
}
$this->User_setUserFieldsValues($this->oUserCurrent->getId(), $aData);
@ -632,7 +638,7 @@ class ActionSettings extends Action {
$aFieldsContactValue=getRequest('profile_user_field_value');
if (is_array($aFieldsContactType)) {
foreach($aFieldsContactType as $k=>$v) {
if (isset($aFields[$v]) and isset($aFieldsContactValue[$k])) {
if (isset($aFields[$v]) and isset($aFieldsContactValue[$k]) and is_string($aFieldsContactValue[$k])) {
$this->User_setUserFieldsValues($this->oUserCurrent->getId(), array($v=>$aFieldsContactValue[$k]), Config::Get('module.user.userfield_max_identical'));
}
}

View file

@ -309,7 +309,7 @@ class ActionStream extends Action {
if (!$this->oUserCurrent) {
parent::EventNotFound();
}
if (!getRequest('login')) {
if (!getRequest('login') or !is_string(getRequest('login'))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}

View file

@ -262,7 +262,7 @@ class ActionTalk extends Action {
/**
* Ключевые слова в теме сообщения
*/
if($sKeyRequest=getRequest('keyword')){
if($sKeyRequest=getRequest('keyword') and is_string($sKeyRequest)){
$sKeyRequest=urldecode($sKeyRequest);
preg_match_all('~(\S+)~u',$sKeyRequest,$aWords);
@ -275,7 +275,7 @@ class ActionTalk extends Action {
/**
* Ключевые слова в тексте сообщения
*/
if($sKeyRequest=getRequest('keyword_text')){
if($sKeyRequest=getRequest('keyword_text') and is_string($sKeyRequest)){
$sKeyRequest=urldecode($sKeyRequest);
preg_match_all('~(\S+)~u',$sKeyRequest,$aWords);
@ -288,7 +288,7 @@ class ActionTalk extends Action {
/**
* Отправитель
*/
if($sender=getRequest('sender')){
if($sender=getRequest('sender') and is_string($sender)){
$aFilter['user_login']=urldecode($sender);
}
/**
@ -478,7 +478,7 @@ class ActionTalk extends Action {
* Проверяем адресатов
*/
$sUsers=getRequest('talk_users');
$aUsers=explode(',',$sUsers);
$aUsers=explode(',',(string)$sUsers);
$aUsersNew=array();
$aUserInBlacklist = $this->Talk_GetBlacklistByTargetId($this->oUserCurrent->getId());
@ -721,7 +721,7 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUsers=getRequest('users',null,'post');
$sUsers=(string)getRequest('users',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -814,7 +814,7 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$idTarget=getRequest('idTarget',null,'post');
$idTarget=(string)getRequest('idTarget',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -879,8 +879,8 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$idTarget=getRequest('idTarget',null,'post');
$idTalk=getRequest('idTalk',null,'post');
$idTarget=(string)getRequest('idTarget',null,'post');
$idTalk=(string)getRequest('idTalk',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -957,8 +957,8 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUsers=getRequest('users',null,'post');
$idTalk=getRequest('idTalk',null,'post');
$sUsers=(string)getRequest('users',null,'post');
$idTalk=(string)getRequest('idTalk',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/

View file

@ -132,7 +132,7 @@ class ActionUserfeed extends Action {
if (!getRequest('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
$sType = getRequest('type');
$sType = (string)getRequest('type');
$iType = null;
/**
* Определяем тип подписки
@ -184,7 +184,7 @@ class ActionUserfeed extends Action {
/**
* Передан ли логин
*/
if (!getRequest('login')) {
if (!getRequest('login') or !is_string(getRequest('login'))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -231,7 +231,7 @@ class ActionUserfeed extends Action {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$sType = getRequest('type');
$sType = (string)getRequest('type');
$iType = null;
/**
* Определяем от чего отписываемся

View file

@ -237,6 +237,9 @@ class ModuleBlog extends Module {
* @return ModuleBlog_EntityBlog|null
*/
public function GetBlogById($sBlogId) {
if (!is_numeric($sBlogId)) {
return null;
}
$aBlogs=$this->GetBlogsAdditionalData($sBlogId);
if (isset($aBlogs[$sBlogId])) {
return $aBlogs[$sBlogId];

View file

@ -50,6 +50,9 @@ class ModuleComment extends Module {
* @return ModuleComment_EntityComment|null
*/
public function GetCommentById($sId) {
if (!is_numeric($sId)) {
return null;
}
$aComments=$this->GetCommentsAdditionalData($sId);
if (isset($aComments[$sId])) {
return $aComments[$sId];

View file

@ -45,6 +45,9 @@ class ModuleFavourite extends Module {
* @return ModuleFavourite_EntityFavourite|null
*/
public function GetFavourite($sTargetId,$sTargetType,$sUserId) {
if (!is_numeric($sTargetId) or !is_string($sTargetType)) {
return null;
}
$data=$this->GetFavouritesByArray($sTargetId,$sTargetType,$sUserId);
return (isset($data[$sTargetId]))
? $data[$sTargetId]

View file

@ -108,6 +108,9 @@ class ModuleStream extends Module {
* @return bool
*/
public function IsAllowEventType($sType) {
if (!is_string($sType)) {
return false;
}
return array_key_exists($sType,$this->aEventTypes);
}
/**

View file

@ -377,6 +377,9 @@ class ModuleTalk extends Module {
* @return ModuleTalk_EntityTalk|null
*/
public function GetTalkById($sId) {
if (!is_numeric($sId)) {
return null;
}
$aTalks=$this->GetTalksAdditionalData($sId);
if (isset($aTalks[$sId])) {
$aResult=$this->GetTalkUsersByTalkId($sId);

View file

@ -376,6 +376,9 @@ class ModuleTopic extends Module {
* @return ModuleTopic_EntityTopic|null
*/
public function GetTopicById($sId) {
if (!is_numeric($sId)) {
return null;
}
$aTopics=$this->GetTopicsAdditionalData($sId);
if (isset($aTopics[$sId])) {
return $aTopics[$sId];

View file

@ -457,6 +457,9 @@ class ModuleUser extends Module {
* @return ModuleUser_EntityUser|null
*/
public function GetUserById($sId) {
if (!is_numeric($sId)) {
return null;
}
$aUsers=$this->GetUsersAdditionalData($sId);
if (isset($aUsers[$sId])) {
return $aUsers[$sId];

View file

@ -203,6 +203,9 @@ class ModuleWall extends Module {
* @return ModuleWall_EntityWall
*/
public function GetWallById($iId) {
if (!is_numeric($iId)) {
return null;
}
$aResult=$this->GetWallAdditionalData($iId);
if (isset($aResult[$iId])) {
return $aResult[$iId];

View file

@ -142,6 +142,9 @@ class ModuleText extends Module {
* @return string
*/
public function Parser($sText) {
if (!is_string($sText)) {
return '';
}
$sResult=$this->FlashParamParser($sText);
$sResult=$this->JevixParser($sResult);
$sResult=$this->VideoParser($sResult);