1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 09:24:25 +03:00

Merge branch 'master' of git://github.com/livestreet/livestreet

This commit is contained in:
kpoxas 2012-12-29 17:43:48 +02:00
commit 0b20e086f9
66 changed files with 823 additions and 371 deletions

View file

@ -12,4 +12,8 @@ RewriteRule ^(.*)$ ./index.php
order allow,deny
deny from all
</Files>
<Files "plugin.xml">
order allow,deny
deny from all
</Files>

View file

@ -19,7 +19,7 @@ before_script:
# launch apache, MySQL and PHPUnit Selenium installers
- ./tests/travis/apache_setup.sh
- ./tests/travis/mysql_setup.sh
- mysql -u root -e "USE social_test; SHOW TABLES;"
- mysql -u root -e "USE social_test; SHOW TABLES;" | wc -l
- cp ./config/config.test.php.dist config/config.test.php
- cp ./config/config.test.php.dist config/config.local.php
- sudo sed -i s/sql-mode/#sql-mode/ /etc/mysql/my.cnf
@ -28,8 +28,7 @@ before_script:
# get HTML of main page (for debug)
- firefox --version
- wget -O /tmp/livestreet.test http://livestreet.test
- cat /tmp/livestreet.test
- wget -S http://livestreet.test -O /dev/null
# start virtual display
- sh -e /etc/init.d/xvfb start
@ -40,7 +39,5 @@ before_script:
- java -jar /tmp/selenium-server-standalone.jar > /dev/null &
- sleep 5
# goto test's folder
- cd tests/behat/
script: HTTP_APP_ENV=test php behat.phar
script: HTTP_APP_ENV=test php tests/behat/behat.phar -c tests/behat/behat.yml

View file

@ -148,7 +148,7 @@ class ActionAdmin extends Action {
/**
* Получаем название плагина и действие
*/
if($sPlugin=getRequest('plugin',null,'get') and $sAction=getRequest('action',null,'get')) {
if($sPlugin=getRequestStr('plugin',null,'get') and $sAction=getRequestStr('action',null,'get')) {
return $this->SubmitManagePlugin($sPlugin,$sAction);
}
/**
@ -171,7 +171,7 @@ class ActionAdmin extends Action {
*/
protected function EventUserFields()
{
switch(getRequest('action')) {
switch(getRequestStr('action')) {
/**
* Создание нового поля
*/
@ -184,11 +184,11 @@ class ActionAdmin extends Action {
return;
}
$oField = Engine::GetEntity('User_Field');
$oField->setName(getRequest('name'));
$oField->setTitle(getRequest('title'));
$oField->setPattern(getRequest('pattern'));
if (in_array(getRequest('type'),$this->User_GetUserFieldTypes())) {
$oField->setType(getRequest('type'));
$oField->setName(getRequestStr('name'));
$oField->setTitle(getRequestStr('title'));
$oField->setPattern(getRequestStr('pattern'));
if (in_array(getRequestStr('type'),$this->User_GetUserFieldTypes())) {
$oField->setType(getRequestStr('type'));
} else {
$oField->setType('');
}
@ -214,11 +214,11 @@ class ActionAdmin extends Action {
* Обрабатываем как ajax запрос (json)
*/
$this->Viewer_SetResponseAjax('json');
if (!getRequest('id')) {
if (!getRequestStr('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$this->User_deleteUserField(getRequest('id'));
$this->User_deleteUserField(getRequestStr('id'));
$this->Message_AddNotice($this->Lang_Get('user_field_deleted'),$this->Lang_Get('attention'));
break;
/**
@ -229,11 +229,11 @@ class ActionAdmin extends Action {
* Обрабатываем как ajax запрос (json)
*/
$this->Viewer_SetResponseAjax('json');
if (!getRequest('id')) {
if (!getRequestStr('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
if (!$this->User_userFieldExistsById(getRequest('id'))) {
if (!$this->User_userFieldExistsById(getRequestStr('id'))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return false;
}
@ -241,12 +241,12 @@ class ActionAdmin extends Action {
return;
}
$oField = Engine::GetEntity('User_Field');
$oField->setId(getRequest('id'));
$oField->setName(getRequest('name'));
$oField->setTitle(getRequest('title'));
$oField->setPattern(getRequest('pattern'));
if (in_array(getRequest('type'),$this->User_GetUserFieldTypes())) {
$oField->setType(getRequest('type'));
$oField->setId(getRequestStr('id'));
$oField->setName(getRequestStr('name'));
$oField->setTitle(getRequestStr('title'));
$oField->setPattern(getRequestStr('pattern'));
if (in_array(getRequestStr('type'),$this->User_GetUserFieldTypes())) {
$oField->setType(getRequestStr('type'));
} else {
$oField->setType('');
}
@ -280,18 +280,18 @@ class ActionAdmin extends Action {
*/
public function checkUserField()
{
if (!getRequest('title')) {
if (!getRequestStr('title')) {
$this->Message_AddError($this->Lang_Get('user_field_error_add_no_title'),$this->Lang_Get('error'));
return false;
}
if (!getRequest('name')) {
if (!getRequestStr('name')) {
$this->Message_AddError($this->Lang_Get('user_field_error_add_no_name'),$this->Lang_Get('error'));
return false;
}
/**
* Не допускаем дубликатов по имени
*/
if ($this->User_userFieldExistsByName(getRequest('name'), getRequest('id'))) {
if ($this->User_userFieldExistsByName(getRequestStr('name'), getRequestStr('id'))) {
$this->Message_AddError($this->Lang_Get('user_field_error_name_exists'),$this->Lang_Get('error'));
return false;
}

View file

@ -124,7 +124,7 @@ class ActionAjax extends Action {
* Получение списка регионов по стране
*/
protected function EventGeoGetRegions() {
$iCountryId=getRequest('country');
$iCountryId=getRequestStr('country');
$iLimit=200;
if (is_numeric(getRequest('limit')) and getRequest('limit')>0) {
$iLimit=getRequest('limit');
@ -156,7 +156,7 @@ class ActionAjax extends Action {
* Получение списка городов по региону
*/
protected function EventGeoGetCities() {
$iRegionId=getRequest('region');
$iRegionId=getRequestStr('region');
$iLimit=500;
if (is_numeric(getRequest('limit')) and getRequest('limit')>0) {
$iLimit=getRequest('limit');
@ -199,7 +199,7 @@ class ActionAjax extends Action {
/**
* Комментарий существует?
*/
if (!($oComment=$this->Comment_GetCommentById(getRequest('idComment',null,'post')))) {
if (!($oComment=$this->Comment_GetCommentById(getRequestStr('idComment',null,'post')))) {
$this->Message_AddErrorSingle($this->Lang_Get('comment_vote_error_noexists'),$this->Lang_Get('error'));
return;
}
@ -234,7 +234,7 @@ class ActionAjax extends Action {
/**
* Как именно голосует пользователь
*/
$iValue=getRequest('value',null,'post');
$iValue=getRequestStr('value',null,'post');
if (!in_array($iValue,array('1','-1'))) {
$this->Message_AddErrorSingle($this->Lang_Get('comment_vote_error_value'),$this->Lang_Get('attention'));
return;
@ -279,7 +279,7 @@ class ActionAjax extends Action {
/**
* Топик существует?
*/
if (!($oTopic=$this->Topic_GetTopicById(getRequest('idTopic',null,'post')))) {
if (!($oTopic=$this->Topic_GetTopicById(getRequestStr('idTopic',null,'post')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -307,7 +307,7 @@ class ActionAjax extends Action {
/**
* Как проголосовал пользователь
*/
$iValue=getRequest('value',null,'post');
$iValue=getRequestStr('value',null,'post');
if (!in_array($iValue,array('1','-1','0'))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('attention'));
return;
@ -372,7 +372,7 @@ class ActionAjax extends Action {
/**
* Блог существует?
*/
if (!($oBlog=$this->Blog_GetBlogById(getRequest('idBlog',null,'post')))) {
if (!($oBlog=$this->Blog_GetBlogById(getRequestStr('idBlog',null,'post')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -395,7 +395,7 @@ class ActionAjax extends Action {
*/
switch($this->ACL_CanVoteBlog($this->oUserCurrent,$oBlog)) {
case ModuleACL::CAN_VOTE_BLOG_TRUE:
$iValue=getRequest('value',null,'post');
$iValue=getRequestStr('value',null,'post');
if (in_array($iValue,array('1','-1'))) {
$oBlogVote=Engine::GetEntity('Vote');
$oBlogVote->setTargetId($oBlog->getId());
@ -450,7 +450,7 @@ class ActionAjax extends Action {
/**
* Пользователь существует?
*/
if (!($oUser=$this->User_GetUserById(getRequest('idUser',null,'post')))) {
if (!($oUser=$this->User_GetUserById(getRequestStr('idUser',null,'post')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -478,7 +478,7 @@ class ActionAjax extends Action {
/**
* Как проголосовал
*/
$iValue=getRequest('value',null,'post');
$iValue=getRequestStr('value',null,'post');
if (!in_array($iValue,array('1','-1'))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('attention'));
return;
@ -525,8 +525,8 @@ class ActionAjax extends Action {
/**
* Параметры голосования
*/
$idAnswer=getRequest('idAnswer',null,'post');
$idTopic=getRequest('idTopic',null,'post');
$idAnswer=getRequestStr('idAnswer',null,'post');
$idTopic=getRequestStr('idTopic',null,'post');
/**
* Топик существует?
*/
@ -596,11 +596,11 @@ class ActionAjax extends Action {
/**
* Объект уже должен быть в избранном
*/
if ($oFavourite=$this->Favourite_GetFavourite(getRequest('target_id'),getRequest('target_type'),$this->oUserCurrent->getId())) {
if ($oFavourite=$this->Favourite_GetFavourite(getRequestStr('target_id'),getRequestStr('target_type'),$this->oUserCurrent->getId())) {
/**
* Обрабатываем теги
*/
$aTags=explode(',',trim((string)getRequest('tags'),"\r\n\t\0\x0B ."));
$aTags=explode(',',trim(getRequestStr('tags'),"\r\n\t\0\x0B ."));
$aTagsNew=array();
$aTagsNewLow=array();
$aTagsReturn=array();
@ -642,7 +642,7 @@ class ActionAjax extends Action {
/**
* Можно только добавить или удалить из избранного
*/
$iType=getRequest('type',null,'post');
$iType=getRequestStr('type',null,'post');
if (!in_array($iType,array('1','0'))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
@ -650,7 +650,7 @@ class ActionAjax extends Action {
/**
* Топик существует?
*/
if (!($oTopic=$this->Topic_GetTopicById(getRequest('idTopic',null,'post')))) {
if (!($oTopic=$this->Topic_GetTopicById(getRequestStr('idTopic',null,'post')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -719,7 +719,7 @@ class ActionAjax extends Action {
/**
* Можно только добавить или удалить из избранного
*/
$iType=getRequest('type',null,'post');
$iType=getRequestStr('type',null,'post');
if (!in_array($iType,array('1','0'))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
@ -727,7 +727,7 @@ class ActionAjax extends Action {
/**
* Комментарий существует?
*/
if (!($oComment=$this->Comment_GetCommentById(getRequest('idComment',null,'post')))) {
if (!($oComment=$this->Comment_GetCommentById(getRequestStr('idComment',null,'post')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -789,7 +789,7 @@ class ActionAjax extends Action {
/**
* Можно только добавить или удалить из избранного
*/
$iType=getRequest('type',null,'post');
$iType=getRequestStr('type',null,'post');
if (!in_array($iType,array('1','0'))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
@ -797,7 +797,7 @@ class ActionAjax extends Action {
/**
* Сообщение существует?
*/
if (!($oTalk=$this->Talk_GetTalkById(getRequest('idTalk',null,'post')))) {
if (!($oTalk=$this->Talk_GetTalkById(getRequestStr('idTalk',null,'post')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -965,7 +965,7 @@ class ActionAjax extends Action {
/**
* Допустимый тип топика?
*/
if (!$this->Topic_IsAllowTopicType($sType=getRequest('topic_type'))) {
if (!$this->Topic_IsAllowTopicType($sType=getRequestStr('topic_type'))) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_create_type_error'),$this->Lang_Get('error'));
return;
}
@ -975,9 +975,9 @@ class ActionAjax extends Action {
$oTopic=Engine::GetEntity('ModuleTopic_EntityTopic');
$oTopic->_setValidateScenario($sType); // зависит от типа топика
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setDateAdd(date("Y-m-d H:i:s"));
$oTopic->setUserId($this->oUserCurrent->getId());
$oTopic->setType($sType);
@ -992,16 +992,10 @@ class ActionAjax extends Action {
/**
* Формируем текст топика
*/
if (in_array($sType,array('link','question'))) {
$oTopic->setCutText(null);
$oTopic->setText(htmlspecialchars($oTopic->getTextSource()));
$oTopic->setTextShort(htmlspecialchars($oTopic->getTextSource()));
} else {
list($sTextShort,$sTextNew,$sTextCut) = $this->Text_Cut($oTopic->getTextSource());
$oTopic->setCutText($sTextCut);
$oTopic->setText($this->Text_Parser($sTextNew));
$oTopic->setTextShort($this->Text_Parser($sTextShort));
}
list($sTextShort,$sTextNew,$sTextCut) = $this->Text_Cut($oTopic->getTextSource());
$oTopic->setCutText($sTextCut);
$oTopic->setText($this->Text_Parser($sTextNew));
$oTopic->setTextShort($this->Text_Parser($sTextShort));
/**
* Рендерим шаблон для предпросмотра топика
*/
@ -1023,7 +1017,7 @@ class ActionAjax extends Action {
*
*/
protected function EventPreviewText() {
$sText=(string)getRequest('text',null,'post');
$sText=getRequestStr('text',null,'post');
$bSave=getRequest('save',null,'post');
/**
* Экранировать или нет HTML теги
@ -1163,7 +1157,7 @@ class ActionAjax extends Action {
/**
* Комментарий существует?
*/
$idComment=getRequest('idComment',null,'post');
$idComment=getRequestStr('idComment',null,'post');
if (!($oComment=$this->Comment_GetCommentById($idComment))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;

View file

@ -198,16 +198,16 @@ class ActionBlog extends Action {
*/
$oBlog=Engine::GetEntity('Blog');
$oBlog->setOwnerId($this->oUserCurrent->getId());
$oBlog->setTitle(strip_tags(getRequest('blog_title')));
$oBlog->setTitle(strip_tags(getRequestStr('blog_title')));
/**
* Парсим текст на предмет разных ХТМЛ тегов
*/
$sText=$this->Text_Parser(getRequest('blog_description'));
$sText=$this->Text_Parser(getRequestStr('blog_description'));
$oBlog->setDescription($sText);
$oBlog->setType(getRequest('blog_type'));
$oBlog->setType(getRequestStr('blog_type'));
$oBlog->setDateAdd(date("Y-m-d H:i:s"));
$oBlog->setLimitRatingTopic(getRequest('blog_limit_rating_topic'));
$oBlog->setUrl((string)getRequest('blog_url'));
$oBlog->setLimitRatingTopic(getRequestStr('blog_limit_rating_topic'));
$oBlog->setUrl(getRequestStr('blog_url'));
$oBlog->setAvatar(null);
/**
* Загрузка аватара, делаем ресайзы
@ -299,23 +299,23 @@ class ActionBlog extends Action {
if (!$this->checkBlogFields($oBlog)) {
return false;
}
$oBlog->setTitle(strip_tags(getRequest('blog_title')));
$oBlog->setTitle(strip_tags(getRequestStr('blog_title')));
/**
* Парсим описание блога на предмет ХТМЛ тегов
*/
$sText=$this->Text_Parser(getRequest('blog_description'));
$sText=$this->Text_Parser(getRequestStr('blog_description'));
$oBlog->setDescription($sText);
/**
* Сбрасываем кеш, если поменяли тип блога
* Нужна доработка, т.к. в этом блоге могут быть топики других юзеров
*/
if ($oBlog->getType()!=getRequest('blog_type')) {
if ($oBlog->getType()!=getRequestStr('blog_type')) {
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array("topic_update_user_{$oBlog->getOwnerId()}"));
}
$oBlog->setType(getRequest('blog_type'));
$oBlog->setLimitRatingTopic(getRequest('blog_limit_rating_topic'));
$oBlog->setType(getRequestStr('blog_type'));
$oBlog->setLimitRatingTopic(getRequestStr('blog_limit_rating_topic'));
if ($this->oUserCurrent->isAdministrator()) {
$oBlog->setUrl((string)getRequest('blog_url')); // разрешаем смену URL блога только админу
$oBlog->setUrl(getRequestStr('blog_url')); // разрешаем смену URL блога только админу
}
/**
* Загрузка аватара, делаем ресайзы
@ -399,6 +399,7 @@ class ActionBlog extends Action {
$aUserRank=array();
}
foreach ($aUserRank as $sUserId => $sRank) {
$sRank=(string)$sRank;
if (!($oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oBlog->getId(),$sUserId))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
break;
@ -498,14 +499,14 @@ class ActionBlog extends Action {
/**
* Проверяем есть ли название блога
*/
if (!func_check(getRequest('blog_title'),'text',2,200)) {
if (!func_check(getRequestStr('blog_title'),'text',2,200)) {
$this->Message_AddError($this->Lang_Get('blog_create_title_error'),$this->Lang_Get('error'));
$bOk=false;
} else {
/**
* Проверяем есть ли уже блог с таким названием
*/
if ($oBlogExists=$this->Blog_GetBlogByTitle(getRequest('blog_title'))) {
if ($oBlogExists=$this->Blog_GetBlogByTitle(getRequestStr('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;
@ -517,9 +518,9 @@ class ActionBlog extends Action {
* Проверяем есть ли URL блога, с заменой всех пробельных символов на "_"
*/
if (!$oBlog or $this->oUserCurrent->isAdministrator()) {
$blogUrl=preg_replace("/\s+/",'_',(string)getRequest('blog_url'));
$blogUrl=preg_replace("/\s+/",'_',getRequestStr('blog_url'));
$_REQUEST['blog_url']=$blogUrl;
if (!func_check(getRequest('blog_url'),'login',2,50)) {
if (!func_check(getRequestStr('blog_url'),'login',2,50)) {
$this->Message_AddError($this->Lang_Get('blog_create_url_error'),$this->Lang_Get('error'));
$bOk=false;
}
@ -527,14 +528,14 @@ class ActionBlog extends Action {
/**
* Проверяем на счет плохих УРЛов
*/
if (in_array(getRequest('blog_url'),$this->aBadBlogUrl)) {
if (in_array(getRequestStr('blog_url'),$this->aBadBlogUrl)) {
$this->Message_AddError($this->Lang_Get('blog_create_url_error_badword').' '.join(',',$this->aBadBlogUrl),$this->Lang_Get('error'));
$bOk=false;
}
/**
* Проверяем есть ли уже блог с таким URL
*/
if ($oBlogExists=$this->Blog_GetBlogByUrl((string)getRequest('blog_url'))) {
if ($oBlogExists=$this->Blog_GetBlogByUrl(getRequestStr('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;
@ -543,21 +544,21 @@ class ActionBlog extends Action {
/**
* Проверяем есть ли описание блога
*/
if (!func_check(getRequest('blog_description'),'text',10,3000)) {
if (!func_check(getRequestStr('blog_description'),'text',10,3000)) {
$this->Message_AddError($this->Lang_Get('blog_create_description_error'),$this->Lang_Get('error'));
$bOk=false;
}
/**
* Проверяем доступные типы блога для создания
*/
if (!in_array(getRequest('blog_type'),array('open','close'))) {
if (!in_array(getRequestStr('blog_type'),array('open','close'))) {
$this->Message_AddError($this->Lang_Get('blog_create_type_error'),$this->Lang_Get('error'));
$bOk=false;
}
/**
* Преобразуем ограничение по рейтингу в число
*/
if (!func_check(getRequest('blog_limit_rating_topic'),'float')) {
if (!func_check(getRequestStr('blog_limit_rating_topic'),'float')) {
$this->Message_AddError($this->Lang_Get('blog_create_rating_error'),$this->Lang_Get('error'));
$bOk=false;
}
@ -573,8 +574,8 @@ class ActionBlog extends Action {
*/
protected function EventTopics() {
$sPeriod=1; // по дефолту 1 день
if (in_array(getRequest('period'),array(1,7,30,'all'))) {
$sPeriod=getRequest('period');
if (in_array(getRequestStr('period'),array(1,7,30,'all'))) {
$sPeriod=getRequestStr('period');
}
$sShowType=$this->sCurrentEvent;
if (!in_array($sShowType,array('discussed','top'))) {
@ -738,6 +739,7 @@ class ActionBlog extends Action {
$sTextSeo=strip_tags($oTopic->getText());
$this->Viewer_SetHtmlDescription(func_text_words($sTextSeo, Config::Get('seo.description_words_count')));
$this->Viewer_SetHtmlKeywords($oTopic->getTags());
$this->Viewer_SetHtmlCanonical($oTopic->getUrl());
/**
* Вызов хуков
*/
@ -812,8 +814,8 @@ class ActionBlog extends Action {
*/
protected function EventShowBlog() {
$sPeriod=1; // по дефолту 1 день
if (in_array(getRequest('period'),array(1,7,30,'all'))) {
$sPeriod=getRequest('period');
if (in_array(getRequestStr('period'),array(1,7,30,'all'))) {
$sPeriod=getRequestStr('period');
}
$sBlogUrl=$this->sCurrentEvent;
$sShowType=in_array($this->GetParamEventMatch(0,0),array('bad','new','newall','discussed','top')) ? $this->GetParamEventMatch(0,0) : 'good';
@ -959,7 +961,7 @@ class ActionBlog extends Action {
/**
* Проверяем топик
*/
if (!($oTopic=$this->Topic_GetTopicById(getRequest('cmt_target_id')))) {
if (!($oTopic=$this->Topic_GetTopicById(getRequestStr('cmt_target_id')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -994,7 +996,7 @@ class ActionBlog extends Action {
/**
* Проверяем текст комментария
*/
$sText=$this->Text_Parser(getRequest('comment_text'));
$sText=$this->Text_Parser(getRequestStr('comment_text'));
if (!func_check($sText,'text',2,10000)) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_add_text_error'),$this->Lang_Get('error'));
return;
@ -1123,14 +1125,14 @@ class ActionBlog extends Action {
/**
* Топик существует?
*/
$idTopic=getRequest('idTarget',null,'post');
$idTopic=getRequestStr('idTarget',null,'post');
if (!($oTopic=$this->Topic_GetTopicById($idTopic))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
$idCommentLast=getRequest('idCommentLast',null,'post');
$selfIdComment=getRequest('selfIdComment',null,'post');
$idCommentLast=getRequestStr('idCommentLast',null,'post');
$selfIdComment=getRequestStr('selfIdComment',null,'post');
$aComments=array();
/**
* Если используется постраничность, возвращаем только добавленный комментарий
@ -1190,7 +1192,7 @@ class ActionBlog extends Action {
*/
$this->Viewer_SetResponseAjax('json');
$sUsers=getRequest('users',null,'post');
$sBlogId=getRequest('idBlog',null,'post');
$sBlogId=getRequestStr('idBlog',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -1336,8 +1338,8 @@ class ActionBlog extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUserId=getRequest('idUser',null,'post');
$sBlogId=getRequest('idBlog',null,'post');
$sUserId=getRequestStr('idUser',null,'post');
$sBlogId=getRequestStr('idBlog',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -1386,8 +1388,8 @@ class ActionBlog extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUserId=getRequest('idUser',null,'post');
$sBlogId=getRequest('idBlog',null,'post');
$sUserId=getRequestStr('idUser',null,'post');
$sBlogId=getRequestStr('idBlog',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -1488,7 +1490,7 @@ class ActionBlog extends Action {
/**
* Получаем код подтверждения из ревеста и дешефруем его
*/
$sCode=xxtea_decrypt(base64_decode(rawurldecode((string)getRequest('code'))), Config::Get('module.blog.encrypt'));
$sCode=xxtea_decrypt(base64_decode(rawurldecode(getRequestStr('code'))), Config::Get('module.blog.encrypt'));
if (!$sCode) {
return $this->EventNotFound();
}
@ -1602,7 +1604,7 @@ class ActionBlog extends Action {
*
* (-1) - выбран пункт меню "удалить топики".
*/
if($sBlogIdNew=getRequest('topic_move_to') and ($sBlogIdNew!=-1) and is_array($aTopics) and count($aTopics)) {
if($sBlogIdNew=getRequestStr('topic_move_to') and ($sBlogIdNew!=-1) and is_array($aTopics) and count($aTopics)) {
if(!$oBlogNew = $this->Blog_GetBlogById($sBlogIdNew)){
$this->Message_AddErrorSingle($this->Lang_Get('blog_admin_delete_move_error'),$this->Lang_Get('error'),true);
Router::Location($oBlog->getUrlFull());
@ -1644,7 +1646,7 @@ class ActionBlog extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sBlogId=getRequest('idBlog',null,'post');
$sBlogId=getRequestStr('idBlog',null,'post');
/**
* Определяем тип блога и получаем его
*/
@ -1682,7 +1684,7 @@ class ActionBlog extends Action {
/**
* Блог существует?
*/
$idBlog=getRequest('idBlog',null,'post');
$idBlog=getRequestStr('idBlog',null,'post');
if (!($oBlog=$this->Blog_GetBlogById($idBlog))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;

View file

@ -58,7 +58,7 @@ class ActionBlogs extends Action {
/**
* Получаем из реквеста первые буквы блога
*/
if ($sTitle=getRequest('blog_title') and is_string($sTitle)) {
if ($sTitle=getRequestStr('blog_title')) {
$sTitle=str_replace('%','',$sTitle);
}
if (!$sTitle) {
@ -87,14 +87,14 @@ class ActionBlogs extends Action {
*/
$sOrder='blog_rating';
if (getRequest('order')) {
$sOrder=(string)getRequest('order');
$sOrder=getRequestStr('order');
}
/**
* В каком направлении сортировать
*/
$sOrderWay='desc';
if (getRequest('order_way')) {
$sOrderWay=(string)getRequest('order_way');
$sOrderWay=getRequestStr('order_way');
}
/**
* Фильтр поиска блогов

View file

@ -94,8 +94,8 @@ class ActionIndex extends Action {
*/
protected function EventTop() {
$sPeriod=1; // по дефолту 1 день
if (in_array(getRequest('period'),array(1,7,30,'all'))) {
$sPeriod=getRequest('period');
if (in_array(getRequestStr('period'),array(1,7,30,'all'))) {
$sPeriod=getRequestStr('period');
}
/**
* Меню
@ -145,8 +145,8 @@ class ActionIndex extends Action {
*/
protected function EventDiscussed() {
$sPeriod=1; // по дефолту 1 день
if (in_array(getRequest('period'),array(1,7,30,'all'))) {
$sPeriod=getRequest('period');
if (in_array(getRequestStr('period'),array(1,7,30,'all'))) {
$sPeriod=getRequestStr('period');
}
/**
* Меню

View file

@ -219,13 +219,13 @@ class ActionLink extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setBlogId(getRequestStr('blog_id'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserId($this->oUserCurrent->getId());
$oTopic->setType('link');
$oTopic->setLinkUrl(getRequest('topic_link_url'));
$oTopic->setLinkUrl(getRequestStr('topic_link_url'));
$oTopic->setDateAdd(date("Y-m-d H:i:s"));
$oTopic->setUserIp(func_getIp());
/**
@ -347,11 +347,11 @@ class ActionLink extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setLinkUrl(getRequest('topic_link_url'));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setBlogId(getRequestStr('blog_id'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setLinkUrl(getRequestStr('topic_link_url'));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserIp(func_getIp());
/**
* Проверка корректности полей формы

View file

@ -87,8 +87,8 @@ class ActionLogin extends Action {
* Определяем редирект
*/
$sUrl=Config::Get('module.user.redirect_after_login');
if (getRequest('return-path')) {
$sUrl=getRequest('return-path');
if (getRequestStr('return-path')) {
$sUrl=getRequestStr('return-path');
}
$this->Viewer_AssignAjax('sUrlRedirect',$sUrl ? $sUrl : Config::Get('path.root.web'));
return;
@ -112,7 +112,7 @@ class ActionLogin extends Action {
protected function EventAjaxReactivation() {
$this->Viewer_SetResponseAjax('json');
if ((func_check(getRequest('mail'), 'mail') and $oUser = $this->User_GetUserByMail(getRequest('mail')))) {
if ((func_check(getRequestStr('mail'), 'mail') and $oUser = $this->User_GetUserByMail(getRequestStr('mail')))) {
if ($oUser->getActivate()) {
$this->Message_AddErrorSingle($this->Lang_Get('registration_activate_error_reactivate'));
return;
@ -162,7 +162,7 @@ class ActionLogin extends Action {
/**
* Пользователь с таким емайлом существует?
*/
if ((func_check(getRequest('mail'),'mail') and $oUser=$this->User_GetUserByMail(getRequest('mail')))) {
if ((func_check(getRequestStr('mail'),'mail') and $oUser=$this->User_GetUserByMail(getRequestStr('mail')))) {
/**
* Формируем и отправляем ссылку на смену пароля
*/

View file

@ -236,14 +236,14 @@ class ActionPeople extends Action {
*/
$sOrder='user_rating';
if (getRequest('order')) {
$sOrder=(string)getRequest('order');
$sOrder=getRequestStr('order');
}
/**
* В каком направлении сортировать
*/
$sOrderWay='desc';
if (getRequest('order_way')) {
$sOrderWay=(string)getRequest('order_way');
$sOrderWay=getRequestStr('order_way');
}
$aFilter=array(
'activate' => 1

View file

@ -74,8 +74,8 @@ class ActionPersonalBlog extends Action {
*/
protected function EventTopics() {
$sPeriod=1; // по дефолту 1 день
if (in_array(getRequest('period'),array(1,7,30,'all'))) {
$sPeriod=getRequest('period');
if (in_array(getRequestStr('period'),array(1,7,30,'all'))) {
$sPeriod=getRequestStr('period');
}
$sShowType=$this->sCurrentEvent;
if (!in_array($sShowType,array('discussed','top'))) {

View file

@ -97,7 +97,7 @@ class ActionPhotoset extends Action {
/**
* Существует ли топик
*/
$oTopic = $this->Topic_getTopicById(getRequest('topic_id'));
$oTopic = $this->Topic_getTopicById(getRequestStr('topic_id'));
if (!$oTopic || !getRequest('last_id')) {
$this->Message_AddError($this->Lang_Get('system_error'), $this->Lang_Get('error'));
return false;
@ -105,7 +105,7 @@ class ActionPhotoset extends Action {
/**
* Получаем список фото
*/
$aPhotos = $oTopic->getPhotosetPhotos(getRequest('last_id'), Config::Get('module.topic.photoset.per_page'));
$aPhotos = $oTopic->getPhotosetPhotos(getRequestStr('last_id'), Config::Get('module.topic.photoset.per_page'));
$aResult = array();
if (count($aPhotos)) {
/**
@ -137,7 +137,7 @@ class ActionPhotoset extends Action {
/**
* Поиск фото по id
*/
$oPhoto = $this->Topic_getTopicPhotoById(getRequest('id'));
$oPhoto = $this->Topic_getTopicPhotoById(getRequestStr('id'));
if ($oPhoto) {
if ($oPhoto->getTopicId()) {
/**
@ -188,16 +188,16 @@ class ActionPhotoset extends Action {
/**
* Поиск фото по id
*/
$oPhoto = $this->Topic_getTopicPhotoById(getRequest('id'));
$oPhoto = $this->Topic_getTopicPhotoById(getRequestStr('id'));
if ($oPhoto) {
if ($oPhoto->getTopicId()) {
// проверяем права на топик
if ($oTopic=$this->Topic_GetTopicById($oPhoto->getTopicId()) and $this->ACL_IsAllowEditTopic($oTopic,$this->oUserCurrent)) {
$oPhoto->setDescription(htmlspecialchars(strip_tags(getRequest('text'))));
$oPhoto->setDescription(htmlspecialchars(strip_tags(getRequestStr('text'))));
$this->Topic_updateTopicPhoto($oPhoto);
}
} else {
$oPhoto->setDescription(htmlspecialchars(strip_tags(getRequest('text'))));
$oPhoto->setDescription(htmlspecialchars(strip_tags(getRequestStr('text'))));
$this->Topic_updateTopicPhoto($oPhoto);
}
}
@ -232,12 +232,12 @@ class ActionPhotoset extends Action {
return false;
}
$iTopicId = getRequest('topic_id');
$iTopicId = getRequestStr('topic_id');
$sTargetId = null;
$iCountPhotos = 0;
// Если от сервера не пришёл id топика, то пытаемся определить временный код для нового топика. Если и его нет. то это ошибка
if (!$iTopicId) {
$sTargetId = empty($_COOKIE['ls_photoset_target_tmp']) ? getRequest('ls_photoset_target_tmp') : $_COOKIE['ls_photoset_target_tmp'];
$sTargetId = empty($_COOKIE['ls_photoset_target_tmp']) ? getRequestStr('ls_photoset_target_tmp') : $_COOKIE['ls_photoset_target_tmp'];
if (!$sTargetId) {
$this->Message_AddError($this->Lang_Get('system_error'), $this->Lang_Get('error'));
return false;
@ -430,10 +430,10 @@ class ActionPhotoset extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setBlogId(getRequestStr('blog_id'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserId($this->oUserCurrent->getId());
$oTopic->setType('photoset');
$oTopic->setDateAdd(date("Y-m-d H:i:s"));
@ -488,7 +488,7 @@ class ActionPhotoset extends Action {
$sTargetTmp=$_COOKIE['ls_photoset_target_tmp'];
$aPhotos = $this->Topic_getPhotosByTargetTmp($sTargetTmp);
if (!($oPhotoMain=$this->Topic_getTopicPhotoById(getRequest('topic_main_photo')) and $oPhotoMain->getTargetTmp()==$sTargetTmp)) {
if (!($oPhotoMain=$this->Topic_getTopicPhotoById(getRequestStr('topic_main_photo')) and $oPhotoMain->getTargetTmp()==$sTargetTmp)) {
$oPhotoMain=$aPhotos[0];
}
$oTopic->setPhotosetMainPhotoId($oPhotoMain->getId());
@ -586,10 +586,10 @@ class ActionPhotoset extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setBlogId(getRequestStr('blog_id'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserIp(func_getIp());
/**
* Проверка корректности полей формы
@ -640,7 +640,7 @@ class ActionPhotoset extends Action {
$oTopic->setTextShort($this->Text_Parser($sTextShort));
$aPhotos = $oTopic->getPhotosetPhotos();
if (!($oPhotoMain=$this->Topic_getTopicPhotoById(getRequest('topic_main_photo')) and $oPhotoMain->getTopicId()==$oTopic->getId())) {
if (!($oPhotoMain=$this->Topic_getTopicPhotoById(getRequestStr('topic_main_photo')) and $oPhotoMain->getTopicId()==$oTopic->getId())) {
$oPhotoMain=$aPhotos[0];
}
$oTopic->setPhotosetMainPhotoId($oPhotoMain->getId());

View file

@ -454,8 +454,8 @@ class ActionProfile extends Action {
$oWall->_setValidateScenario('add');
$oWall->setWallUserId($this->oUserProfile->getId());
$oWall->setUserId($this->oUserCurrent->getId());
$oWall->setText(getRequest('sText'));
$oWall->setPid(getRequest('iPid'));
$oWall->setText(getRequestStr('sText'));
$oWall->setPid(getRequestStr('iPid'));
$this->Hook_Run('wall_add_validate_before', array('oWall'=>$oWall));
if ($oWall->_Validate()) {
@ -506,7 +506,7 @@ class ActionProfile extends Action {
/**
* Получаем запись
*/
if (!($oWall=$this->Wall_GetWallById(getRequest('iId')))) {
if (!($oWall=$this->Wall_GetWallById(getRequestStr('iId')))) {
return parent::EventNotFound();
}
/**
@ -565,7 +565,7 @@ class ActionProfile extends Action {
if (!$this->CheckUserProfile()) {
return parent::EventNotFound();
}
if (!($oWall=$this->Wall_GetWallById(getRequest('iPid'))) or $oWall->getPid()) {
if (!($oWall=$this->Wall_GetWallById(getRequestStr('iPid'))) or $oWall->getPid()) {
return parent::EventNotFound();
}
/**
@ -611,9 +611,9 @@ class ActionProfile extends Action {
* Создаем заметку и проводим валидацию
*/
$oNote=Engine::GetEntity('ModuleUser_EntityNote');
$oNote->setTargetUserId(getRequest('iUserId'));
$oNote->setTargetUserId(getRequestStr('iUserId'));
$oNote->setUserId($this->oUserCurrent->getId());
$oNote->setText((string)getRequest('text'));
$oNote->setText(getRequestStr('text'));
if ($oNote->_Validate()) {
/**
@ -641,7 +641,7 @@ class ActionProfile extends Action {
return parent::EventNotFound();
}
if (!($oUserTarget=$this->User_GetUserById(getRequest('iUserId')))) {
if (!($oUserTarget=$this->User_GetUserById(getRequestStr('iUserId')))) {
return parent::EventNotFound();
}
if (!($oNote=$this->User_GetUserNote($oUserTarget->getId(),$this->oUserCurrent->getId()))) {
@ -696,7 +696,7 @@ class ActionProfile extends Action {
/**
* Из реквеста дешефруем ID польователя
*/
$sUserId=xxtea_decrypt(base64_decode(rawurldecode((string)getRequest('code'))), Config::Get('module.talk.encrypt'));
$sUserId=xxtea_decrypt(base64_decode(rawurldecode(getRequestStr('code'))), Config::Get('module.talk.encrypt'));
if (!$sUserId) {
return $this->EventNotFound();
}
@ -776,7 +776,7 @@ class ActionProfile extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUserId=getRequest('idUser',null,'post');
$sUserId=getRequestStr('idUser',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -896,8 +896,8 @@ class ActionProfile extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUserId=getRequest('idUser');
$sUserText=getRequest('userText','');
$sUserId=getRequestStr('idUser');
$sUserText=getRequestStr('userText','');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -1120,7 +1120,7 @@ class ActionProfile extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUserId=getRequest('idUser',null,'post');
$sUserId=getRequestStr('idUser',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/

View file

@ -190,10 +190,10 @@ class ActionQuestion extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setBlogId(getRequestStr('blog_id'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserId($this->oUserCurrent->getId());
$oTopic->setType('question');
$oTopic->setDateAdd(date("Y-m-d H:i:s"));
@ -246,7 +246,7 @@ class ActionQuestion extends Action {
*/
$oTopic->clearQuestionAnswer();
foreach (getRequest('answer',array()) as $sAnswer) {
$oTopic->addQuestionAnswer($sAnswer);
$oTopic->addQuestionAnswer((string)$sAnswer);
}
/**
* Публикуем или сохраняем
@ -324,12 +324,12 @@ class ActionQuestion extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setBlogId(getRequestStr('blog_id'));
if ($oTopic->getQuestionCountVote()==0) {
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
}
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserIp(func_getIp());
/**
* Проверка корректности полей формы
@ -380,7 +380,7 @@ class ActionQuestion extends Action {
if ($oTopic->getQuestionCountVote()==0) {
$oTopic->clearQuestionAnswer();
foreach (getRequest('answer',array()) as $sAnswer) {
$oTopic->addQuestionAnswer($sAnswer);
$oTopic->addQuestionAnswer((string)$sAnswer);
}
}
/**
@ -476,6 +476,7 @@ class ActionQuestion extends Action {
*/
$aAnswers=getRequest('answer',array());
foreach ($aAnswers as $key => $sAnswer) {
$sAnswer=(string)$sAnswer;
if (trim($sAnswer)=='') {
unset($aAnswers[$key]);
continue;

View file

@ -148,11 +148,11 @@ class ActionRegistration extends Action {
/**
* Заполняем поля (данные)
*/
$oUser->setLogin(getRequest('login'));
$oUser->setMail(getRequest('mail'));
$oUser->setPassword(getRequest('password'));
$oUser->setPasswordConfirm(getRequest('password_confirm'));
$oUser->setCaptcha(getRequest('captcha'));
$oUser->setLogin(getRequestStr('login'));
$oUser->setMail(getRequestStr('mail'));
$oUser->setPassword(getRequestStr('password'));
$oUser->setPasswordConfirm(getRequestStr('password_confirm'));
$oUser->setCaptcha(getRequestStr('captcha'));
$oUser->setDateRegister(date("Y-m-d H:i:s"));
$oUser->setIpRegister(func_getIp());
/**
@ -198,10 +198,10 @@ class ActionRegistration extends Action {
/**
* Отправляем на мыло письмо о подтверждении регистрации
*/
$this->Notify_SendRegistrationActivate($oUser,getRequest('password'));
$this->Notify_SendRegistrationActivate($oUser,getRequestStr('password'));
$this->Viewer_AssignAjax('sUrlRedirect',Router::GetPath('registration').'confirm/');
} else {
$this->Notify_SendRegistration($oUser,getRequest('password'));
$this->Notify_SendRegistration($oUser,getRequestStr('password'));
$oUser=$this->User_GetUserById($oUser->getId());
/**
* Сразу авторизуем
@ -212,8 +212,8 @@ class ActionRegistration extends Action {
* Определяем URL для редиректа после авторизации
*/
$sUrl=Config::Get('module.user.redirect_after_registration');
if (getRequest('return-path')) {
$sUrl=getRequest('return-path');
if (getRequestStr('return-path')) {
$sUrl=getRequestStr('return-path');
}
$this->Viewer_AssignAjax('sUrlRedirect',$sUrl ? $sUrl : Config::Get('path.root.web'));
$this->Message_AddNoticeSingle($this->Lang_Get('registration_ok'));
@ -304,7 +304,7 @@ class ActionRegistration extends Action {
if ($this->CheckInviteRegister()) {
$sInviteId=$this->GetInviteRegister();
} else {
$sInviteId=getRequest('invite_code');
$sInviteId=getRequestStr('invite_code');
}
$oInvate=$this->User_GetInviteByCode($sInviteId);
if ($oInvate) {

View file

@ -169,7 +169,7 @@ class ActionSearch extends Action {
* @return array
*/
private function PrepareRequest(){
$aReq['q'] = getRequest('q');
$aReq['q'] = getRequestStr('q');
if (!func_check($aReq['q'],'text', 2, 255)) {
/**
* Если запрос слишком короткий перенаправляем на начальную страницу поиска

View file

@ -360,8 +360,8 @@ class ActionSettings extends Action {
if (isPost('submit_settings_tuning')) {
$this->Security_ValidateSendForm();
if (in_array(getRequest('settings_general_timezone'),$aTimezoneList)) {
$this->oUserCurrent->setSettingsTimezone(getRequest('settings_general_timezone'));
if (in_array(getRequestStr('settings_general_timezone'),$aTimezoneList)) {
$this->oUserCurrent->setSettingsTimezone(getRequestStr('settings_general_timezone'));
}
$this->oUserCurrent->setSettingsNoticeNewTopic( getRequest('settings_notice_new_topic') ? 1 : 0 );
@ -420,7 +420,7 @@ class ActionSettings extends Action {
/**
* Емайл корректен?
*/
if (!func_check(getRequest('invite_mail'),'mail')) {
if (!func_check(getRequestStr('invite_mail'),'mail')) {
$this->Message_AddError($this->Lang_Get('settings_invite_mail_error'),$this->Lang_Get('error'));
$bError=true;
}
@ -433,7 +433,7 @@ class ActionSettings extends Action {
*/
if (!$bError) {
$oInvite=$this->User_GenerateInvite($this->oUserCurrent);
$this->Notify_SendInvite($this->oUserCurrent,getRequest('invite_mail'),$oInvite);
$this->Notify_SendInvite($this->oUserCurrent,getRequestStr('invite_mail'),$oInvite);
$this->Message_AddNoticeSingle($this->Lang_Get('settings_invite_submit_ok'));
$this->Hook_Run('settings_invate_send_after', array('oUser'=>$this->oUserCurrent));
}
@ -461,8 +461,8 @@ class ActionSettings extends Action {
/**
* Проверка мыла
*/
if (func_check(getRequest('mail'),'mail')) {
if ($oUserMail=$this->User_GetUserByMail(getRequest('mail')) and $oUserMail->getId()!=$this->oUserCurrent->getId()) {
if (func_check(getRequestStr('mail'),'mail')) {
if ($oUserMail=$this->User_GetUserByMail(getRequestStr('mail')) and $oUserMail->getId()!=$this->oUserCurrent->getId()) {
$this->Message_AddError($this->Lang_Get('settings_profile_mail_error_used'),$this->Lang_Get('error'));
$bError=true;
}
@ -473,11 +473,11 @@ class ActionSettings extends Action {
/**
* Проверка на смену пароля
*/
if (getRequest('password','')!='') {
if (func_check(getRequest('password'),'password',5)) {
if (getRequest('password')==getRequest('password_confirm')) {
if (func_encrypt(getRequest('password_now'))==$this->oUserCurrent->getPassword()) {
$this->oUserCurrent->setPassword(func_encrypt(getRequest('password')));
if (getRequestStr('password','')!='') {
if (func_check(getRequestStr('password'),'password',5)) {
if (getRequestStr('password')==getRequestStr('password_confirm')) {
if (func_encrypt(getRequestStr('password_now'))==$this->oUserCurrent->getPassword()) {
$this->oUserCurrent->setPassword(func_encrypt(getRequestStr('password')));
} else {
$bError=true;
$this->Message_AddError($this->Lang_Get('settings_profile_password_current_error'),$this->Lang_Get('error'));
@ -508,8 +508,8 @@ class ActionSettings extends Action {
/**
* Подтверждение смены емайла
*/
if (getRequest('mail') and getRequest('mail')!=$this->oUserCurrent->getMail()) {
if ($oChangemail=$this->User_MakeUserChangemail($this->oUserCurrent,getRequest('mail'))) {
if (getRequestStr('mail') and getRequestStr('mail')!=$this->oUserCurrent->getMail()) {
if ($oChangemail=$this->User_MakeUserChangemail($this->oUserCurrent,getRequestStr('mail'))) {
if ($oChangemail->getMailFrom()) {
$this->Message_AddNotice($this->Lang_Get('settings_profile_mail_change_from_notice'));
} else {
@ -556,43 +556,43 @@ class ActionSettings extends Action {
* Определяем гео-объект
*/
if (getRequest('geo_city')) {
$oGeoObject=$this->Geo_GetGeoObject('city',getRequest('geo_city'));
$oGeoObject=$this->Geo_GetGeoObject('city',getRequestStr('geo_city'));
} elseif (getRequest('geo_region')) {
$oGeoObject=$this->Geo_GetGeoObject('region',getRequest('geo_region'));
$oGeoObject=$this->Geo_GetGeoObject('region',getRequestStr('geo_region'));
} elseif (getRequest('geo_country')) {
$oGeoObject=$this->Geo_GetGeoObject('country',getRequest('geo_country'));
$oGeoObject=$this->Geo_GetGeoObject('country',getRequestStr('geo_country'));
} else {
$oGeoObject=null;
}
/**
* Проверяем имя
*/
if (func_check(getRequest('profile_name'),'text',2,Config::Get('module.user.name_max'))) {
$this->oUserCurrent->setProfileName(getRequest('profile_name'));
if (func_check(getRequestStr('profile_name'),'text',2,Config::Get('module.user.name_max'))) {
$this->oUserCurrent->setProfileName(getRequestStr('profile_name'));
} else {
$this->oUserCurrent->setProfileName(null);
}
/**
* Проверяем пол
*/
if (in_array(getRequest('profile_sex'),array('man','woman','other'))) {
$this->oUserCurrent->setProfileSex(getRequest('profile_sex'));
if (in_array(getRequestStr('profile_sex'),array('man','woman','other'))) {
$this->oUserCurrent->setProfileSex(getRequestStr('profile_sex'));
} else {
$this->oUserCurrent->setProfileSex('other');
}
/**
* Проверяем дату рождения
*/
if (func_check(getRequest('profile_birthday_day'),'id',1,2) and func_check(getRequest('profile_birthday_month'),'id',1,2) and func_check(getRequest('profile_birthday_year'),'id',4,4)) {
$this->oUserCurrent->setProfileBirthday(date("Y-m-d H:i:s",mktime(0,0,0,getRequest('profile_birthday_month'),getRequest('profile_birthday_day'),getRequest('profile_birthday_year'))));
if (func_check(getRequestStr('profile_birthday_day'),'id',1,2) and func_check(getRequestStr('profile_birthday_month'),'id',1,2) and func_check(getRequestStr('profile_birthday_year'),'id',4,4)) {
$this->oUserCurrent->setProfileBirthday(date("Y-m-d H:i:s",mktime(0,0,0,getRequestStr('profile_birthday_month'),getRequestStr('profile_birthday_day'),getRequestStr('profile_birthday_year'))));
} else {
$this->oUserCurrent->setProfileBirthday(null);
}
/**
* Проверяем информацию о себе
*/
if (func_check(getRequest('profile_about'),'text',1,3000)) {
$this->oUserCurrent->setProfileAbout($this->Text_Parser(getRequest('profile_about')));
if (func_check(getRequestStr('profile_about'),'text',1,3000)) {
$this->oUserCurrent->setProfileAbout($this->Text_Parser(getRequestStr('profile_about')));
} else {
$this->oUserCurrent->setProfileAbout(null);
}
@ -644,7 +644,7 @@ class ActionSettings extends Action {
$aData = array();
foreach ($aFields as $iId => $aField) {
if (isset($_REQUEST['profile_user_field_'.$iId])) {
$aData[$iId] = (string)getRequest('profile_user_field_'.$iId);
$aData[$iId] = getRequestStr('profile_user_field_'.$iId);
}
}
$this->User_setUserFieldsValues($this->oUserCurrent->getId(), $aData);
@ -661,6 +661,7 @@ class ActionSettings extends Action {
$aFieldsContactValue=getRequest('profile_user_field_value');
if (is_array($aFieldsContactType)) {
foreach($aFieldsContactType as $k=>$v) {
$v=(string)$v;
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

@ -136,7 +136,7 @@ class ActionStream extends Action {
/**
* Активируем/деактивируем тип
*/
$this->Stream_switchUserEventType($this->oUserCurrent->getId(), getRequest('type'));
$this->Stream_switchUserEventType($this->oUserCurrent->getId(), getRequestStr('type'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
/**
@ -157,7 +157,7 @@ class ActionStream extends Action {
/**
* Необходимо передать последний просмотренный ID событий
*/
$iFromId = getRequest('last_id');
$iFromId = getRequestStr('last_id');
if (!$iFromId) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
@ -169,7 +169,7 @@ class ActionStream extends Action {
$oViewer=$this->Viewer_GetLocalViewer();
$oViewer->Assign('aStreamEvents', $aEvents);
$oViewer->Assign('sDateLast', getRequest('date_last'));
$oViewer->Assign('sDateLast', getRequestStr('date_last'));
if (count($aEvents)) {
$oEvenLast=end($aEvents);
$this->Viewer_AssignAjax('iStreamLastId', $oEvenLast->getId());
@ -198,7 +198,7 @@ class ActionStream extends Action {
/**
* Необходимо передать последний просмотренный ID событий
*/
$iFromId = getRequest('last_id');
$iFromId = getRequestStr('last_id');
if (!$iFromId) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
@ -210,7 +210,7 @@ class ActionStream extends Action {
$oViewer=$this->Viewer_GetLocalViewer();
$oViewer->Assign('aStreamEvents', $aEvents);
$oViewer->Assign('sDateLast', getRequest('date_last'));
$oViewer->Assign('sDateLast', getRequestStr('date_last'));
if (count($aEvents)) {
$oEvenLast=end($aEvents);
$this->Viewer_AssignAjax('iStreamLastId', $oEvenLast->getId());
@ -239,12 +239,12 @@ class ActionStream extends Action {
/**
* Необходимо передать последний просмотренный ID событий
*/
$iFromId = getRequest('last_id');
$iFromId = getRequestStr('last_id');
if (!$iFromId) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
if (!($oUser=$this->User_GetUserById(getRequest('user_id')))) {
if (!($oUser=$this->User_GetUserById(getRequestStr('user_id')))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -255,7 +255,7 @@ class ActionStream extends Action {
$oViewer=$this->Viewer_GetLocalViewer();
$oViewer->Assign('aStreamEvents', $aEvents);
$oViewer->Assign('sDateLast', getRequest('date_last'));
$oViewer->Assign('sDateLast', getRequestStr('date_last'));
if (count($aEvents)) {
$oEvenLast=end($aEvents);
$this->Viewer_AssignAjax('iStreamLastId', $oEvenLast->getId());
@ -284,17 +284,17 @@ class ActionStream extends Action {
/**
* Проверяем существование пользователя
*/
if (!$this->User_getUserById(getRequest('id'))) {
if (!$this->User_getUserById(getRequestStr('id'))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
if ($this->oUserCurrent->getId() == getRequest('id')) {
if ($this->oUserCurrent->getId() == getRequestStr('id')) {
$this->Message_AddError($this->Lang_Get('stream_error_subscribe_to_yourself'),$this->Lang_Get('error'));
return;
}
/**
* Подписываем на пользователя
*/
$this->Stream_subscribeUser($this->oUserCurrent->getId(), getRequest('id'));
$this->Stream_subscribeUser($this->oUserCurrent->getId(), getRequestStr('id'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
/**
@ -319,9 +319,9 @@ class ActionStream extends Action {
/**
* Проверяем существование пользователя
*/
$oUser = $this->User_getUserByLogin(getRequest('login'));
$oUser = $this->User_getUserByLogin(getRequestStr('login'));
if (!$oUser) {
$this->Message_AddError($this->Lang_Get('user_not_found',array('login'=>htmlspecialchars(getRequest('login')))),$this->Lang_Get('error'));
$this->Message_AddError($this->Lang_Get('user_not_found',array('login'=>htmlspecialchars(getRequestStr('login')))),$this->Lang_Get('error'));
return;
}
if ($this->oUserCurrent->getId() == $oUser->getId()) {
@ -356,13 +356,13 @@ class ActionStream extends Action {
/**
* Пользователь с таким ID существует?
*/
if (!$this->User_getUserById(getRequest('id'))) {
if (!$this->User_getUserById(getRequestStr('id'))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
/**
* Отписываем
*/
$this->Stream_unsubscribeUser($this->oUserCurrent->getId(), getRequest('id'));
$this->Stream_unsubscribeUser($this->oUserCurrent->getId(), getRequestStr('id'));
$this->Message_AddNotice($this->Lang_Get('stream_subscribes_updated'), $this->Lang_Get('attention'));
}
/**

View file

@ -88,7 +88,7 @@ class ActionSubscribe extends Action {
/**
* Получаем емайл подписки и проверяем его на валидность
*/
$sMail=getRequest('mail');
$sMail=getRequestStr('mail');
if ($this->oUserCurrent) {
$sMail=$this->oUserCurrent->getMail();
}
@ -99,12 +99,12 @@ class ActionSubscribe extends Action {
/**
* Получаем тип объекта подписки
*/
$sTargetType=getRequest('target_type');
$sTargetType=getRequestStr('target_type');
if (!$this->Subscribe_IsAllowTargetType($sTargetType)) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return ;
}
$sTargetId=getRequest('target_id') ? getRequest('target_id') : null;
$sTargetId=getRequestStr('target_id') ? getRequestStr('target_id') : null;
$iValue=getRequest('value') ? 1 : 0;
$oSubscribe=null;

View file

@ -216,7 +216,7 @@ class ActionTalk extends Action {
/**
* Дата старта поиска
*/
if($start=getRequest('start')) {
if($start=getRequestStr('start')) {
if(func_check($start,'text',6,10) && substr_count($start,'.')==2) {
list($d,$m,$y)=explode('.',$start);
if(@checkdate($m,$d,$y)) {
@ -239,7 +239,7 @@ class ActionTalk extends Action {
/**
* Дата окончания поиска
*/
if($end=getRequest('end')) {
if($end=getRequestStr('end')) {
if(func_check($end,'text',6,10) && substr_count($end,'.')==2) {
list($d,$m,$y)=explode('.',$end);
if(@checkdate($m,$d,$y)) {
@ -377,7 +377,7 @@ class ActionTalk extends Action {
/**
* Отправляем письмо
*/
if ($oTalk=$this->Talk_SendTalk($this->Text_Parser(strip_tags(getRequest('talk_title'))),$this->Text_Parser(getRequest('talk_text')),$this->oUserCurrent,$this->aUsersId)) {
if ($oTalk=$this->Talk_SendTalk($this->Text_Parser(strip_tags(getRequestStr('talk_title'))),$this->Text_Parser(getRequestStr('talk_text')),$this->oUserCurrent,$this->aUsersId)) {
Router::Location(Router::GetPath('talk').'read/'.$oTalk->getId().'/');
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));
@ -463,14 +463,14 @@ class ActionTalk extends Action {
/**
* Проверяем есть ли заголовок
*/
if (!func_check(getRequest('talk_title'),'text',2,200)) {
if (!func_check(getRequestStr('talk_title'),'text',2,200)) {
$this->Message_AddError($this->Lang_Get('talk_create_title_error'),$this->Lang_Get('error'));
$bOk=false;
}
/**
* Проверяем есть ли содержание топика
*/
if (!func_check(getRequest('talk_text'),'text',2,3000)) {
if (!func_check(getRequestStr('talk_text'),'text',2,3000)) {
$this->Message_AddError($this->Lang_Get('talk_create_text_error'),$this->Lang_Get('error'));
$bOk=false;
}
@ -537,7 +537,7 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$idCommentLast=getRequest('idCommentLast');
$idCommentLast=getRequestStr('idCommentLast');
/**
* Проверям авторизован ли пользователь
*/
@ -548,7 +548,7 @@ class ActionTalk extends Action {
/**
* Проверяем разговор
*/
if (!($oTalk=$this->Talk_GetTalkById(getRequest('idTarget')))) {
if (!($oTalk=$this->Talk_GetTalkById(getRequestStr('idTarget')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -611,7 +611,7 @@ class ActionTalk extends Action {
/**
* Проверяем разговор
*/
if (!($oTalk=$this->Talk_GetTalkById(getRequest('cmt_target_id')))) {
if (!($oTalk=$this->Talk_GetTalkById(getRequestStr('cmt_target_id')))) {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -629,7 +629,7 @@ class ActionTalk extends Action {
/**
* Проверяем текст комментария
*/
$sText=$this->Text_Parser(getRequest('comment_text'));
$sText=$this->Text_Parser(getRequestStr('comment_text'));
if (!func_check($sText,'text',2,3000)) {
$this->Message_AddErrorSingle($this->Lang_Get('talk_comment_add_text_error'),$this->Lang_Get('error'));
return;
@ -724,7 +724,7 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUsers=(string)getRequest('users',null,'post');
$sUsers=getRequestStr('users',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -817,7 +817,7 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$idTarget=(string)getRequest('idTarget',null,'post');
$idTarget=getRequestStr('idTarget',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -882,8 +882,8 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$idTarget=(string)getRequest('idTarget',null,'post');
$idTalk=(string)getRequest('idTalk',null,'post');
$idTarget=getRequestStr('idTarget',null,'post');
$idTalk=getRequestStr('idTalk',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/
@ -960,8 +960,8 @@ class ActionTalk extends Action {
* Устанавливаем формат Ajax ответа
*/
$this->Viewer_SetResponseAjax('json');
$sUsers=(string)getRequest('users',null,'post');
$idTalk=(string)getRequest('idTalk',null,'post');
$sUsers=getRequestStr('users',null,'post');
$idTalk=getRequestStr('idTalk',null,'post');
/**
* Если пользователь не авторизирован, возвращаем ошибку
*/

View file

@ -239,10 +239,10 @@ class ActionTopic extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setBlogId(getRequestStr('blog_id'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserId($this->oUserCurrent->getId());
$oTopic->setType('topic');
$oTopic->setDateAdd(date("Y-m-d H:i:s"));
@ -373,10 +373,10 @@ class ActionTopic extends Action {
/**
* Заполняем поля для валидации
*/
$oTopic->setBlogId(getRequest('blog_id'));
$oTopic->setTitle(strip_tags(getRequest('topic_title')));
$oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags'));
$oTopic->setBlogId(getRequestStr('blog_id'));
$oTopic->setTitle(strip_tags(getRequestStr('topic_title')));
$oTopic->setTextSource(getRequestStr('topic_text'));
$oTopic->setTags(getRequestStr('topic_tags'));
$oTopic->setUserIp(func_getIp());
/**
* Проверка корректности полей формы

View file

@ -92,7 +92,7 @@ class ActionUserfeed extends Action {
/**
* Проверяем последний просмотренный ID топика
*/
$iFromId = getRequest('last_id');
$iFromId = getRequestStr('last_id');
if (!$iFromId) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
@ -132,7 +132,7 @@ class ActionUserfeed extends Action {
if (!getRequest('id')) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
}
$sType = (string)getRequest('type');
$sType = getRequestStr('type');
$iType = null;
/**
* Определяем тип подписки
@ -143,7 +143,7 @@ class ActionUserfeed extends Action {
/**
* Проверяем существование блога
*/
if (!$this->Blog_GetBlogById(getRequest('id'))) {
if (!$this->Blog_GetBlogById(getRequestStr('id'))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
@ -153,11 +153,11 @@ class ActionUserfeed extends Action {
/**
* Проверяем существование пользователя
*/
if (!$this->User_GetUserById(getRequest('id'))) {
if (!$this->User_GetUserById(getRequestStr('id'))) {
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
return;
}
if ($this->oUserCurrent->getId() == getRequest('id')) {
if ($this->oUserCurrent->getId() == getRequestStr('id')) {
$this->Message_AddError($this->Lang_Get('userfeed_error_subscribe_to_yourself'),$this->Lang_Get('error'));
return;
}
@ -169,7 +169,7 @@ class ActionUserfeed extends Action {
/**
* Подписываем
*/
$this->Userfeed_subscribeUser($this->oUserCurrent->getId(), $iType, getRequest('id'));
$this->Userfeed_subscribeUser($this->oUserCurrent->getId(), $iType, getRequestStr('id'));
$this->Message_AddNotice($this->Lang_Get('userfeed_subscribes_updated'), $this->Lang_Get('attention'));
}
/**
@ -191,9 +191,9 @@ class ActionUserfeed extends Action {
/**
* Проверяем существование прользователя
*/
$oUser = $this->User_getUserByLogin(getRequest('login'));
$oUser = $this->User_getUserByLogin(getRequestStr('login'));
if (!$oUser) {
$this->Message_AddError($this->Lang_Get('user_not_found',array('login'=>htmlspecialchars(getRequest('login')))),$this->Lang_Get('error'));
$this->Message_AddError($this->Lang_Get('user_not_found',array('login'=>htmlspecialchars(getRequestStr('login')))),$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 = (string)getRequest('type');
$sType = getRequestStr('type');
$iType = null;
/**
* Определяем от чего отписываемся
@ -250,7 +250,7 @@ class ActionUserfeed extends Action {
/**
* Отписываем пользователя
*/
$this->Userfeed_unsubscribeUser($this->oUserCurrent->getId(), $iType, getRequest('id'));
$this->Userfeed_unsubscribeUser($this->oUserCurrent->getId(), $iType, getRequestStr('id'));
$this->Message_AddNotice($this->Lang_Get('userfeed_subscribes_updated'), $this->Lang_Get('attention'));
}
/**

View file

@ -311,10 +311,20 @@ class ModuleACL extends Module {
/**
* Если модер или админ блога
*/
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
return true;
if ($this->User_GetUserCurrent() and $this->User_GetUserCurrent()->getId()==$oUser->getId()) {
/**
* Для авторизованного пользователя данный код будет работать быстрее
*/
if ($oTopic->getBlog()->getUserIsAdministrator() or $oTopic->getBlog()->getUserIsModerator()) {
return true;
}
} else {
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
return true;
}
}
return false;
}
/**
@ -340,9 +350,18 @@ class ModuleACL extends Module {
/**
* Если модер или админ блога
*/
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
return true;
if ($this->User_GetUserCurrent() and $this->User_GetUserCurrent()->getId()==$oUser->getId()) {
/**
* Для авторизованного пользователя данный код будет работать быстрее
*/
if ($oTopic->getBlog()->getUserIsAdministrator() or $oTopic->getBlog()->getUserIsModerator()) {
return true;
}
} else {
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
return true;
}
}
return false;
}

View file

@ -674,6 +674,7 @@ class ModuleComment_MapperComment extends Mapper {
target_id IN (?a)
AND
target_type = ?
ORDER BY comment_id DESC
";
if ($this->oDb->query($sql,$aTargetId,$sTargetType)) {
return true;

View file

@ -418,7 +418,7 @@ class ModuleTalk extends Module {
$aTalkId=array($aTalkId);
}
foreach ($aTalkId as $sTalkId) {
if ($oTalk=$this->Talk_GetTalkById($sTalkId)) {
if ($oTalk=$this->Talk_GetTalkById((string)$sTalkId)) {
if ($oTalkUser=$this->Talk_GetTalkUser($oTalk->getId(),$iUserId)) {
$oTalkUser->setDateLast(date("Y-m-d H:i:s"));
if ($oTalk->getCommentIdLast()) {
@ -447,7 +447,7 @@ class ModuleTalk extends Module {
$this->DeleteFavouriteTalk(
Engine::GetEntity('Favourite',
array(
'target_id' => $sTalkId,
'target_id' => (string)$sTalkId,
'target_type' => 'talk',
'user_id' => $sUserId
)
@ -456,6 +456,7 @@ class ModuleTalk extends Module {
}
// Нужно почистить зависимые кеши
foreach ($aTalkId as $sTalkId) {
$sTalkId=(string)$sTalkId;
$this->Cache_Clean(
Zend_Cache::CLEANING_MODE_MATCHING_TAG,
array("update_talk_user_{$sTalkId}")
@ -466,6 +467,7 @@ class ModuleTalk extends Module {
// Удаляем пустые беседы, если в них нет пользователей
foreach ($aTalkId as $sTalkId) {
$sTalkId=(string)$sTalkId;
if (!count($this->GetUsersTalk($sTalkId, array(self::TALK_USER_ACTIVE)))) {
$this->DeleteTalk($sTalkId);
}

View file

@ -359,6 +359,14 @@ class ModuleTopic_EntityTopic extends Entity {
return Router::GetPath('blog').$this->getBlog()->getUrl().'/'.$this->getId().'.html';
}
}
/**
* Возвращает полный URL до страницы редактировани топика
*
* @return string
*/
public function getUrlEdit() {
return Router::GetPath($this->getType()).'edit/'.$this->getId().'/';
}
/**
* Возвращает объект голосования за топик текущим пользователем
*
@ -386,6 +394,39 @@ class ModuleTopic_EntityTopic extends Entity {
}
return false;
}
/**
* Проверяет разрешение на удаление топика у текущего пользователя
*
* @return bool
*/
public function getIsAllowDelete() {
if ($oUser=$this->User_GetUserCurrent()) {
return $this->ACL_IsAllowDeleteTopic($this,$oUser);
}
return false;
}
/**
* Проверяет разрешение на редактирование топика у текущего пользователя
*
* @return bool
*/
public function getIsAllowEdit() {
if ($oUser=$this->User_GetUserCurrent()) {
return $this->ACL_IsAllowEditTopic($this,$oUser);
}
return false;
}
/**
* Проверяет разрешение на какое-либо действие для топика у текущего пользователя
*
* @return bool
*/
public function getIsAllowAction() {
if ($this->User_GetUserCurrent()) {
return $this->getIsAllowEdit() || $this->getIsAllowDelete();
}
return false;
}
/**
* Возвращает количество добавивших топик в избранное
*

View file

@ -28,7 +28,6 @@ $config['view']['img_resize_width'] = 570; // до какого размер
$config['view']['img_max_width'] = 5000; // максимальная ширина загружаемых изображений в пикселях
$config['view']['img_max_height'] = 5000; // максимальная высота загружаемых изображений в пикселях
$config['view']['img_max_size_url'] = 500; // максимальный размер картинки в kB для загрузки по URL
$config['view']['no_assign'] = array('db'); // список групп конфигурации, которые необходимо исключить из передачи во Viewer. Только для системного пользования.
/**
* Настройки СЕО для вывода топиков
@ -83,6 +82,7 @@ $config['path']['smarty']['template'] = '___path.root.server___/templates/skin/_
$config['path']['smarty']['compiled'] = '___path.root.server___/templates/compiled';
$config['path']['smarty']['cache'] = '___path.root.server___/templates/cache';
$config['path']['smarty']['plug'] = '___path.root.engine___/modules/viewer/plugs';
$config['smarty']['compile_check'] = true; // Проверять или нет файлы шаблона на изменения перед компиляцией, false может значительно увеличить быстродействие, но потребует ручного удаления кеша при изменения шаблона
/**
* Настройки плагинов
*/
@ -121,7 +121,7 @@ $config['sys']['mail']['include_talk'] = true; // Вклю
*/
// Устанавливаем настройки кеширования
$config['sys']['cache']['use'] = true; // использовать кеширование или нет
$config['sys']['cache']['type'] = 'file'; // тип кеширования: file и memory. memory использует мемкеш
$config['sys']['cache']['type'] = 'file'; // тип кеширования: file, xcache и memory. memory использует мемкеш, xcache - использует XCache
$config['sys']['cache']['dir'] = '___path.root.server___/tmp/'; // каталог для файлового кеша, также используется для временных картинок. По умолчанию подставляем каталог для хранения сессий
$config['sys']['cache']['prefix'] = 'livestreet_cache'; // префикс кеширования, чтоб можно было на одной машине держать несколько сайтов с общим кешевым хранилищем
$config['sys']['cache']['directory_level'] = 1; // уровень вложенности директорий файлового кеша
@ -222,10 +222,6 @@ $config['module']['comment']['nested_page_reverse'] = true; // Определя
$config['module']['comment']['favourite_target_allow'] = array('topic'); // Список типов комментов, которые разрешено добавлять в избранное
// Модуль Talk
$config['module']['talk']['per_page'] = 30; // Число приватных сообщений на одну страницу
$config['module']['talk']['reload'] = false;
$config['module']['talk']['request'] = 60;
$config['module']['talk']['period'] = 20000;
$config['module']['talk']['max_errors'] = 4;
$config['module']['talk']['encrypt'] = 'livestreet'; // Ключ XXTEA шифрования идентификаторов в ссылках
$config['module']['talk']['max_users'] = 15; // Максимальное число адресатов в одном личном сообщении
// Модуль Lang
@ -261,7 +257,6 @@ $config['module']['image']['foto']['round_corner'] = false;
$config['module']['image']['topic']['watermark_use'] = false;
$config['module']['image']['topic']['round_corner'] = false;
// Модуль Security
$config['module']['security']['key'] = "livestreet_security_key"; // ключ сессии для хранения security-кода
$config['module']['security']['hash'] = "livestreet_security_key"; // "примесь" к строке, хешируемой в качестве security-кода
$config['module']['userfeed']['count_default'] = 10; // Число топиков в ленте по умолчанию

View file

@ -161,6 +161,12 @@ return array(
array('±', '©', '©', '®', '©', '©', '®')
)
),
// Список допустимых протоколов для ссылок
'cfgSetLinkProtocolAllow' => array(
array(
array('http','https','ftp')
)
),
'cfgSetTagNoTypography' => array(
array(
array('code','video','object')

View file

@ -1156,7 +1156,7 @@ class LS extends LsObject {
*
* @return Engine
*/
public function E() {
static public function E() {
return Engine::GetInstance();
}
/**
@ -1167,7 +1167,7 @@ class LS extends LsObject {
* @param array $aParams Параметры для передачи в конструктор
* @return Entity
*/
public function Ent($sName,$aParams=array()) {
static public function Ent($sName,$aParams=array()) {
return Engine::GetEntity($sName,$aParams);
}
/**
@ -1179,7 +1179,7 @@ class LS extends LsObject {
* @param DbSimple_Mysql|null $oConnect Объект коннекта к БД
* @return mixed
*/
public function Mpr($sClassName,$sName=null,$oConnect=null) {
static public function Mpr($sClassName,$sName=null,$oConnect=null) {
return Engine::GetMapper($sClassName,$sName,$oConnect);
}
/**
@ -1188,7 +1188,7 @@ class LS extends LsObject {
*
* @return ModuleUser_EntityUser
*/
public function CurUsr() {
static public function CurUsr() {
return self::E()->User_GetUserCurrent();
}
/**
@ -1198,7 +1198,7 @@ class LS extends LsObject {
*
* @return bool
*/
public function Adm() {
static public function Adm() {
return self::CurUsr() && self::CurUsr()->isAdministrator();
}
/**

View file

@ -231,7 +231,7 @@ class MapperORM extends Mapper {
$sFilterFields='';
foreach ($aFilterFields as $k => $v) {
$aK=explode(' ',trim($k));
$sFieldCurrent=$aK[0];
$sFieldCurrent=$this->oDb->escape($aK[0],true);
$sConditionCurrent=' = ';
if (count($aK)>1) {
$sConditionCurrent=strtolower($aK[1]);
@ -273,7 +273,7 @@ class MapperORM extends Mapper {
} elseif (!in_array($value,array('asc','desc'))) {
$value='asc';
}
$key = $oEntitySample->_getField($key);
$key = $this->oDb->escape($oEntitySample->_getField($key),true);
$sOrder.=" {$key} {$value},";
}
$sOrder=trim($sOrder,',');

2
engine/console/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

2
engine/include/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

View file

@ -102,6 +102,19 @@ function getRequest($sName,$default=null,$sType=null) {
return $default;
}
/**
* функция доступа к GET POST параметрам, которая значение принудительно приводит к строке
*
* @param string $sName
* @param mixed $default
* @param string $sType
*
* @return string
*/
function getRequestStr($sName,$default=null,$sType=null) {
return (string)getRequest($sName,$default,$sType);
}
/**
* Определяет был ли передан указанный параметр методом POST
*

View file

@ -123,6 +123,8 @@ class Jevix{
protected $tagsStack;
protected $openedTag;
protected $autoReplace; // Автозамена
protected $linkProtocolAllow=array();
protected $linkProtocolAllowDefault=array('http','https','ftp');
protected $isXHTMLMode = true; // <br/>, <img/>
protected $isAutoBrMode = true; // \n = <br/>
protected $isAutoLinkMode = true;
@ -371,6 +373,23 @@ class Jevix{
$this->autoReplace = array('from' => $from, 'to' => $to);
}
/**
* Устанавливает список разрешенных протоколов для ссылок (http, ftp и т.п.)
*
* @param array $aProtocol Список протоколов
* @param bool $bClearDefault Удалить дефолтные протоколы?
*/
function cfgSetLinkProtocolAllow($aProtocol, $bClearDefault=false){
if (!is_array($aProtocol)) {
$aProtocol=array($aProtocol);
}
if ($bClearDefault) {
$this->linkProtocolAllow=$aProtocol;
} else {
$this->linkProtocolAllow=array_merge($this->linkProtocolAllowDefault,$aProtocol);
}
}
/**
* Включение или выключение режима XTML
*
@ -984,7 +1003,8 @@ class Jevix{
continue(2);
}
// HTTP в начале если нет
if(!preg_match('/^(http|https|ftp):\/\//ui', $value) && !preg_match('/^(\/|\#)/ui', $value) && !preg_match('/^(mailto):/ui', $value) ) $value = 'http://'.$value;
$sProtocols=join('|',$this->linkProtocolAllow ? $this->linkProtocolAllow : $this->linkProtocolAllowDefault);
if(!preg_match('/^('.$sProtocols.'):\/\//ui', $value) && !preg_match('/^(\/|\#)/ui', $value) && !preg_match('/^(mailto):/ui', $value) ) $value = 'http://'.$value;
break;
case '#image':

View file

@ -33,8 +33,8 @@ if(isset($_REQUEST[session_name()])){
}
foreach ($_REQUEST as $key => $value) {
if (preg_match("/^[\w\d]{5,40}$/",(string)$value)) {
session_name($key);
if (preg_match("/^.{5,100}$/",(string)$value)) {
@session_name($key);
session_start();
break;
}

View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

View file

@ -191,12 +191,11 @@ class Config {
}
}
} else {
if(preg_match('~___([\S|\.|]+)___~Ui',$cfg))
$cfg = preg_replace_callback(
'~___([\S|\.]+)___~Ui',
create_function('$value','return Config::Get($value[1],"'.$sInstance.'");'),
$cfg
);
if(preg_match_all('~___([\S|\.]+)___~Ui',$cfg,$aMatch,PREG_SET_ORDER)) {
foreach($aMatch as $aItem) {
$cfg=str_replace('___'.$aItem[1].'___',Config::Get($aItem[1],$sInstance),$cfg);
}
}
}
return $cfg;
}

View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

2
engine/modules/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order Deny,Allow
Deny from all

View file

@ -354,6 +354,7 @@ class ModulePlugin extends Module {
$aActivePlugins=$this->GetActivePlugins();
foreach ($aPlugins as $sPluginCode) {
if (!is_string($sPluginCode)) continue;
/**
* Если плагин активен, деактивируем его
*/

View file

@ -202,11 +202,12 @@ class ModuleViewer extends Module {
$this->sHtmlDescription=Config::Get('view.description');
/**
* Создаём объект Smarty и устанавливаем необходиму параметры
* Создаём объект Smarty и устанавливаем необходимые параметры
*/
$this->oSmarty = $this->CreateSmartyObject();
$this->oSmarty->error_reporting=error_reporting()^E_NOTICE; // подавляем NOTICE ошибки - в этом вся прелесть смарти )
$this->oSmarty->error_reporting=error_reporting() & ~E_NOTICE; // подавляем NOTICE ошибки - в этом вся прелесть смарти )
$this->oSmarty->setTemplateDir(array_merge((array)Config::Get('path.smarty.template'),array(Config::Get('path.root.server').'/plugins/')));
$this->oSmarty->compile_check=Config::Get('smarty.compile_check');
/**
* Для каждого скина устанавливаем свою директорию компиляции шаблонов
*/
@ -214,7 +215,8 @@ class ModuleViewer extends Module {
if(!is_dir($sCompilePath)) @mkdir($sCompilePath);
$this->oSmarty->setCompileDir($sCompilePath);
$this->oSmarty->setCacheDir(Config::Get('path.smarty.cache'));
$this->oSmarty->setPluginsDir(array_merge(array(Config::Get('path.smarty.plug'),'plugins'),$this->oSmarty->getPluginsDir()));
$this->oSmarty->addPluginsDir(array(Config::Get('path.smarty.plug'),'plugins'));
$this->oSmarty->default_template_handler_func=array($this,'SmartyDefaultTemplateHandler');
/**
* Получаем настройки JS, CSS файлов
*/
@ -1392,6 +1394,42 @@ class ModuleViewer extends Module {
$this->aMenuFetch[$sContainer]=$this->Fetch($sTemplate);
}
}
/**
* Обработка поиска файла шаблона, если его не смог найти шаблонизатор Smarty
*
* @param string $sType Тип шаблона/ресурса
* @param string $sName Имя шаблона - имя файла
* @param string $sContent Возврат содержания шаблона при return true;
* @param int $iTimestamp Возврат даты модификации шаблона при return true;
* @param Smarty $oSmarty Объект Smarty
* @return string|bool
*/
public function SmartyDefaultTemplateHandler($sType,$sName,&$sContent,&$iTimestamp,$oSmarty) {
/**
* Название шаблона может содержать, как полный путь до файла шаблона, так и относительный любого из каталога в $oSmarty->getTemplateDir()
* По дефолту каталоги такие: /templates/skin/[name]/ и /plugins/
*/
/**
* Задача: если это файл плагина для текущего шаблона, то смотрим этот же файл шаблона плагина в /default/
*/
if (Config::Get('view.skin')!='default') {
// /root/plugins/[plugin name]/templates/skin/[skin name]/dir/test.tpl
if (preg_match('@^'.preg_quote(Config::Get('path.root.server')).'/plugins/([\w\-_]+)/templates/skin/'.preg_quote(Config::Get('view.skin')).'/@i',$sName,$aMatch)) {
$sFile=str_replace($aMatch[0],Config::Get('path.root.server').'/plugins/'.$aMatch[1].'/templates/skin/default/',$sName);
if ($this->TemplateExists($sFile)) {
return $sFile;
}
}
// [plugin name]/templates/skin/[skin name]/dir/test.tpl
if (preg_match('@^([\w\-_]+)/templates/skin/'.preg_quote(Config::Get('view.skin')).'/@i',$sName,$aMatch)) {
$sFile=Config::Get('path.root.server').'/plugins/'.str_replace($aMatch[0],$aMatch[1].'/templates/skin/default/',$sName);
if ($this->TemplateExists($sFile)) {
return $sFile;
}
}
}
return false;
}
/**
* Загружаем переменные в шаблон при завершении модуля
*
@ -1419,4 +1457,4 @@ class ModuleViewer extends Module {
$this->MenuVarAssign();
}
}
?>
?>

View file

@ -71,7 +71,7 @@
<button type="submit" name="submit_topic_publish" id="submit_topic_publish" class="button button-primary fl-r">{$aLang.topic_create_submit_publish}</button>
<button type="submit" name="submit_preview" onclick="jQuery('#text_preview').parent().show(); ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_preview" onclick="ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_topic_save" id="submit_topic_save" class="button">{$aLang.topic_create_submit_save}</button>
</form>

View file

@ -141,7 +141,7 @@
<button type="submit" name="submit_topic_publish" id="submit_topic_publish" class="button button-primary fl-r">{$aLang.topic_create_submit_publish}</button>
<button type="submit" name="submit_preview" onclick="jQuery('#text_preview').parent().show(); ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_preview" onclick="ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_topic_save" id="submit_topic_save" class="button">{$aLang.topic_create_submit_save}</button>
</form>

View file

@ -89,7 +89,7 @@
{hook run='form_add_topic_question_end'}
<button type="submit" name="submit_topic_publish" id="submit_topic_publish" class="button button-primary fl-r">{$aLang.topic_create_submit_publish}</button>
<button type="submit" name="submit_preview" onclick="jQuery('#text_preview').parent().show(); ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_preview" onclick="ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_topic_save" id="submit_topic_save" class="button">{$aLang.topic_create_submit_save}</button>
</form>

View file

@ -2,6 +2,7 @@ The user <a href="{$oUserFrom->getUserWebPath()}">{$oUserFrom->getLogin()}</a> l
{if $oConfig->GetValue('sys.mail.include_talk')}
Message: <i>{$oTalkComment->getText()}</i> <br>
{/if}
<br>
Do not forget to register before!
<br><br>
Best regards, site administration <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -3,6 +3,7 @@ Letter topic: <b>{$oTalk->getTitle()|escape:'html'}</b><br>
{if $oConfig->GetValue('sys.mail.include_talk')}
Message: <i>{$oTalk->getText()}</i> <br>
{/if}
<br>
Don't forget to register before!
<br><br>
Best regards, site administration <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -2,6 +2,7 @@
{if $oConfig->GetValue('sys.mail.include_talk')}
Текст сообщения: <i>{$oTalkComment->getText()}</i> <br>
{/if}
<br>
Не забудьте предварительно авторизоваться!
<br><br>
С уважением, администрация сайта <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -3,6 +3,7 @@
{if $oConfig->GetValue('sys.mail.include_talk')}
Текст сообщения: <i>{$oTalk->getText()}</i> <br>
{/if}
<br>
Не забудьте предварительно авторизоваться!
<br><br>
С уважением, администрация сайта <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -35,15 +35,17 @@
<time datetime="{date_format date=$oTopic->getDateAdd() format='c'}" title="{date_format date=$oTopic->getDateAdd() format='j F Y, H:i'}">
{date_format date=$oTopic->getDateAdd() format="j F Y, H:i"}
</time>
<ul class="actions">
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getUserIsModerator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
<li><a href="{cfg name='path.root.web'}/{$oTopic->getType()}/edit/{$oTopic->getId()}/" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
{/if}
{if $oUserCurrent and ($oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
<li><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
{/if}
</ul>
{if $oTopic->getIsAllowAction()}
<ul class="actions">
{if $oTopic->getIsAllowEdit()}
<li><a href="{$oTopic->getUrlEdit()}" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
{/if}
{if $oTopic->getIsAllowDelete()}
<li><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
{/if}
</ul>
{/if}
</div>
</header>

View file

@ -72,7 +72,7 @@
<button type="submit" name="submit_topic_publish" id="submit_topic_publish" class="button button-primary fl-r">{$aLang.topic_create_submit_publish}</button>
<button type="submit" name="submit_preview" onclick="jQuery('#text_preview').parent().show(); ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_preview" onclick="ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_topic_save" id="submit_topic_save" class="button">{$aLang.topic_create_submit_save}</button>
</form>

View file

@ -142,7 +142,7 @@
<button type="submit" name="submit_topic_publish" id="submit_topic_publish" class="button button-primary fl-r">{$aLang.topic_create_submit_publish}</button>
<button type="submit" name="submit_preview" onclick="jQuery('#text_preview').parent().show(); ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_preview" onclick="ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_topic_save" id="submit_topic_save" class="button">{$aLang.topic_create_submit_save}</button>
</form>

View file

@ -89,7 +89,7 @@
{hook run='form_add_topic_question_end'}
<button type="submit" name="submit_topic_publish" id="submit_topic_publish" class="button button-primary fl-r">{$aLang.topic_create_submit_publish}</button>
<button type="submit" name="submit_preview" onclick="jQuery('#text_preview').parent().show(); ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_preview" onclick="ls.topic.preview('form-topic-add','text_preview'); return false;" class="button">{$aLang.topic_create_submit_preview}</button>
<button type="submit" name="submit_topic_save" id="submit_topic_save" class="button">{$aLang.topic_create_submit_save}</button>
</form>

View file

@ -2,6 +2,7 @@ The user <a href="{$oUserFrom->getUserWebPath()}">{$oUserFrom->getLogin()}</a> l
{if $oConfig->GetValue('sys.mail.include_talk')}
Message: <i>{$oTalkComment->getText()}</i> <br>
{/if}
<br>
Do not forget to register before!
<br><br>
Best regards, site administration <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -3,6 +3,7 @@ Letter topic: <b>{$oTalk->getTitle()|escape:'html'}</b><br>
{if $oConfig->GetValue('sys.mail.include_talk')}
Message: <i>{$oTalk->getText()}</i> <br>
{/if}
<br>
Don't forget to register before!
<br><br>
Best regards, site administration <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -2,6 +2,7 @@
{if $oConfig->GetValue('sys.mail.include_talk')}
Текст сообщения: <i>{$oTalkComment->getText()}</i> <br>
{/if}
<br>
Не забудьте предварительно авторизоваться!
<br><br>
С уважением, администрация сайта <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -3,6 +3,7 @@
{if $oConfig->GetValue('sys.mail.include_talk')}
Текст сообщения: <i>{$oTalk->getText()}</i> <br>
{/if}
<br>
Не забудьте предварительно авторизоваться!
<br><br>
С уважением, администрация сайта <a href="{cfg name='path.root.web'}">{cfg name='view.name'}</a>

View file

@ -29,13 +29,13 @@
{/if}
</div>
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getUserIsModerator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
{if $oTopic->getIsAllowAction()}
<ul class="topic-actions">
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getUserIsModerator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
<li class="edit"><i class="icon-synio-actions-edit"></i><a href="{cfg name='path.root.web'}/{$oTopic->getType()}/edit/{$oTopic->getId()}/" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
{if $oTopic->getIsAllowEdit()}
<li class="edit"><i class="icon-synio-actions-edit"></i><a href="{$oTopic->getUrlEdit()}" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
{/if}
{if $oUserCurrent and ($oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
{if $oTopic->getIsAllowDelete()}
<li class="delete"><i class="icon-synio-actions-delete"></i><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
{/if}
</ul>

View file

@ -28,9 +28,8 @@ class LoadFixtures
*/
private $sDirFixtures;
public function __construct() {
$this->oEngine = Engine::getInstance();
$this->oEngine->Init();
public function __construct($oEngine) {
$this->oEngine = $oEngine;
$this->sDirFixtures = realpath((dirname(__FILE__)) . "/fixtures/");
}
@ -53,7 +52,7 @@ class LoadFixtures
WHERE TABLE_SCHEMA = '" . $sDbname . "'");
mysql_query('SET FOREIGN_KEY_CHECKS = 0');
echo "TRUNCATE TABLE FROM TEST BASE";
echo "TRUNCATE TABLE FROM TEST BASE\n";
while ($row = mysql_fetch_row($result)) {
if (!mysql_query($row[0])) {
// exception
@ -82,7 +81,7 @@ class LoadFixtures
throw new Exception("DB is not exported with file sql.sql");
return $result['errors'];
}
echo "ExportSQL DATABASE $sDbname -> sql.sql \n";
echo "ExportSQL DATABASE $sDbname -> install_base.sql \n";
// Load dump from geo_base.sql
$result = $this->oEngine->Database_ExportSQL(dirname(__FILE__) . '/fixtures/sql/geo_base.sql');
@ -95,6 +94,17 @@ class LoadFixtures
}
}
// Load dump from INSERT_BASE (SQL-Query)
$result = $this->oEngine->Database_ExportSQL(dirname(__FILE__) . '/fixtures/sql/insert.sql');
if (!$result['result']) {
// exception
throw new Exception("DB is not exported with file insert.sql");
return $result['errors'];
}
echo "Export INSERT SQL to DATABASE $sDbname\n";
return true;
}
@ -124,6 +134,9 @@ class LoadFixtures
foreach ($aClassNames as $sClassName) {
// @todo референсы дублируются в каждом объекте фиксту + в этом объекте
$oFixtures = new $sClassName($this->oEngine, $this->aReferences);
if (!$oFixtures instanceof AbstractFixtures) {
throw new Exception($sClassName . " must extend of AbstractFixtures");
}
$oFixtures->load();
$aFixtureReference = $oFixtures->getReferences();
$this->aReferences = array_merge($this->aReferences, $aFixtureReference);
@ -146,16 +159,7 @@ class LoadFixtures
$this->sDirFixtures = $sPath;
$this->loadFixtures();
echo "Load Fixture Plugin ... ---> {$plugin}\n";
}
/**
* Function of activate plugin
*
* @param string $plugin
*/
public function activationPlugin($plugin){
$this->oEngine->ModulePlugin_Toggle($plugin,'Activate');
}
}

View file

@ -47,3 +47,17 @@ Feature: LiveStreet standart features
14 steps (14 passed)
0m2.225s
```
4) Для тестирования плагинов используется команда
HTTP_APP_ENV=test php behat.phar --config='../../plugins/(название плагина)/tests/behat/behat.yml'
5) При написании дополнительных тестов используются следующие правила:
а) Доступ из базового контекcта к контексту MINK должен производится через функцию getMinkContext()
Пример получения доступа к сессии: $this->getMinkContext()->getSession()
б) Получение доступа к базовому обьекту Engine производится посредством метода: $this->getEngine()
Прим: public function getEngine() {
return $this->getSubcontext('base')->getEngine();
}

View file

@ -4,9 +4,9 @@ Feature: LiveStreet standart features
Scenario: See main page
Given I am on homepage
Then the response status code should be 200
Then I should see "Sony MicroVault Mach USB 3.0 flash drive"
Then I should see "Blogger's name golfer"
Then I should see "Blogger's name user-golfer"
Then I should see "iPad 3 rumored to come this March with quad-core chip and 4G LTE "
Then I should see "Toshiba unveils 13.3-inch AT330 Android ICS 4.0 tablet"
@ -24,7 +24,7 @@ Feature: LiveStreet standart features
Then the response status code should be 200
Then I should see "Gadgets"
Then I should see "golfer"
Then I should see "user-golfer"
Scenario: See all new topics
Given I am on "/index/newall/"
@ -35,8 +35,8 @@ Feature: LiveStreet standart features
Then I should see "Toshiba unveils 13.3-inch AT330 Android ICS 4.0 tablet"
Scenario: See user profile
Given I am on "/profile/Golfer/"
Given I am on "/profile/user-golfer/"
Then the response status code should be 200
Then I should see "Sergey Doryba"
Then I should see "... Sergey Doryba profile description"
Then I should see "user-golfer"
Then I should see "... Golfer profile description"

View file

@ -4,6 +4,7 @@ use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\MinkExtension\Context\MinkContext,
Behat\Mink\Exception\ExpectationException,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
@ -16,22 +17,47 @@ require_once("tests/LoadFixtures.php");
/**
* LiveStreet custom feature context
*/
class BaseFeatureContext extends MinkContext
class BaseFeatureContext extends BehatContext
{
protected static $fixturesLoader = null;
protected $fixturesLoader = null;
protected $oEngine = NULL;
public function __construct()
{
$this->sDirRoot = dirname(realpath((dirname(__FILE__)) . "/../../../"));
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
}
public function getEngine()
{
return $this->oEngine;
}
public function initEngine()
{
if(!$this->oEngine) {
$this->oEngine = Engine::getInstance();
$this->oEngine->Init();
}
}
/**
* Get fixtures loader
* @return LoadFixtures
*/
protected static function getFixturesLoader()
protected function getFixturesLoader()
{
if (is_null(self::$fixturesLoader)) {
self::$fixturesLoader = new LoadFixtures();
if (is_null($this->fixturesLoader)) {
$this->fixturesLoader = new LoadFixtures($this->getEngine());
}
return self::$fixturesLoader;
return $this->fixturesLoader;
}
public function getMinkContext()
{
return $this->getMainContext();
}
/**
@ -39,8 +65,10 @@ class BaseFeatureContext extends MinkContext
*
* @BeforeScenario
*/
public static function prepare($event){
$fixturesLoader = self::getFixturesLoader();
public function prepare($event)
{
$this->initEngine();
$fixturesLoader = $this->getFixturesLoader();
$fixturesLoader->purgeDB();
$fixturesLoader->load();
}
@ -56,22 +84,179 @@ class BaseFeatureContext extends MinkContext
$fixturesLoader->loadPluginFixtures($plugin);
}
/**
* @Given /^I am activated plugin "([^"]*)"$/
*/
public function ActivatedPlugin($plugin)
{
$pluginActivation = new LoadFixtures();
$pluginActivation->activationPlugin($plugin);
}
/**
* @Then /^I wait "([^"]*)"$/
*/
public function iWait($time_wait)
{
$this->getSession()->wait($time_wait);
$this->getMinkContext()->getSession()->wait($time_wait);
}
/**
* Check is sets are present in content
*
* @Then /^the response have sets:$/
*/
public function ResponseHaveSets( $table)
{
$actual = $this->getMinkContext()->getSession()->getPage()->getContent();
foreach ($table->getHash() as $genreHash) {
$regex = '/'.preg_quote($genreHash['value'], '/').'/ui';
if (!preg_match($regex, $actual)) {
$message = sprintf('The string "%s" was not found anywhere in the HTML response of the current page.', $genreHash['value']);
throw new ExpectationException($message, $this->getMinkContext()->getSession());
}
}
}
/**
* @Then /^I should see in element by css "([^"]*)" values:$/
*/
public function iShouldSeeInContainerValues($objectId, TableNode $table)
{
$element = $this->getMinkContext()->getSession()->getPage()->find('css', "#{$objectId}");
if ($element) {
$content = $element->getHtml();
foreach ($table->getHash() as $genreHash) {
$regex = '/'.preg_quote($genreHash['value'], '/').'/ui';
if (!preg_match($regex, $content)) {
$message = sprintf('The string "%s" was not found anywhere in container', $genreHash['value']);
throw new ExpectationException($message, $this->getMinkContext()->getSession());
}
}
}
else {
throw new ExpectationException('Container not found', $this->getMinkContext()->getSession());
}
}
/**
* @Then /^I should not see in element by css "([^"]*)" values:$/
*/
public function iShouldNotSeeInContainerValues($objectId, TableNode $table)
{
$element = $this->getMinkContext()->getSession()->getPage()->find('css', "#{$objectId}");
if ($element) {
$content = $element->getHtml();
foreach ($table->getHash() as $genreHash) {
$regex = '/'.preg_quote($genreHash['value'], '/').'/ui';
if (preg_match($regex, $content)) {
$message = sprintf('The string "%s" was found in container', $genreHash['value']);
throw new ExpectationException($message, $this->getMinkContext()->getSession());
}
}
}
else {
throw new ExpectationException('Container not found', $this->getMinkContext()->getSession());
}
}
/**
* Get content type and compare with set
*
* @Then /^content type is "([^"]*)"$/
*/
public function contentTypeIs($contentType)
{
$header = $this->getMinkContext()->getSession()->getResponseHeaders();
if ($contentType != $header['Content-Type']) {
$message = sprintf('Current content type is "%s", but "%s" expected.', $header['Content-Type'], $contentType);
throw new ExpectationException($message, $this->getMinkContext()->getSession());
}
}
/**
* Try to login user
*
* @Then /^I want to login as "([^"]*)"$/
*/
public function iWantToLoginAs($sUserLogin)
{
$oUser = $this->getEngine()->User_GetUserByLogin($sUserLogin);
if (!$oUser) {
throw new ExpectationException( sprintf('User %s not found', $sUserLogin), $this->getMinkContext()->getSession());
}
$this->getEngine()->User_Authorization($oUser, false);
$oSession = $this->getEngine()->User_GetSessionByUserId($oUser->getId());
if (!$oSession) {
throw new ExpectationException( 'Session non created', $this->getMinkContext()->getSession());
}
$this->getMinkContext()->getSession()->getDriver()->setCookie("key", $oSession->getKey());
}
/**
* Checking for activity of plugin
*
* @Then /^check is plugin active "([^"]*)"$/
*/
public function CheckIsPluginActive($sPluginName)
{
$activePlugins = $this->getEngine()->Plugin_GetActivePlugins();
if (!in_array($sPluginName, $activePlugins)) {
throw new ExpectationException( sprintf('Plugin %s is not active', $sPluginName), $this->getMinkContext()->getSession());
}
}
/**
* @Given /^I press element by css "([^"]*)"$/
*/
public function IPressElementCss($path)
{
$element = $this->getMinkContext()->getSession()->getPage()->find('css', $path );
if ($element) {
$element->click();
}
else {
throw new ExpectationException('Button not found', $this->getMinkContext()->getSession());
}
}
/**
* @Then /^I set carma "([^"]*)" to user "([^"]*)"$/
*/
public function iSetCarmaToUser($carmaPoints, $userName)
{
$oUser = $this->getEngine()->User_GetUserByLogin($userName);
if (!$oUser) {
throw new ExpectationException('User non exists', $this->getSession());
}
$oUser->setRating((int)$carmaPoints);
$this->getEngine()->User_Update($oUser);
}
/**
* @When /^I put the file "([^"]*)" to "([^"]*)"$/
*/
public function iPutTheFileTo($fileName, $path)
{
$fixturePath = realpath((dirname(__FILE__)) . "/../../../../");
$this->getMinkContext()->attachFileToField($path, $fixturePath . $fileName);
}
/**
* @Then /^run script "([^"]*)" and result should contain "([^"]*)"$/
*/
public function runScript($scriptPath, $regex)
{
if (!file_exists($this->sDirRoot . $scriptPath)) {
throw new ExpectationException('Script file not found', $this->getMinkContext()->getSession());
}
$response = shell_exec($this->sDirRoot . $scriptPath);
if (!preg_match($regex, $response)) {
throw new ExpectationException('Invalid script response', $this->getMinkContext()->getSession());
}
}
}

View file

@ -1,11 +1,20 @@
<?php
use Behat\MinkExtension\Context\MinkContext;
require_once("BaseFeatureContext.php");
/**
* LiveStreet custom feature context
*/
class FeatureContext extends BaseFeatureContext
class FeatureContext extends MinkContext
{
public function __construct(array $parameters)
{
$this->parameters = $parameters;
$this->useContext('base', new BaseFeatureContext($parameters));
}
public function getEngine() {
return $this->getSubcontext('base')->getEngine();
}
}

View file

@ -11,11 +11,11 @@ class BlogFixtures extends AbstractFixtures
public function load()
{
$oUserStfalcon = $this->getReference('user-golfer');
$oUserFirst = $this->getReference('user-golfer');
/* @var $oBlogGadgets ModuleBlog_EntityBlog */
$oBlogGadgets = Engine::GetEntity('Blog');
$oBlogGadgets->setOwnerId($oUserStfalcon->getId());
$oBlogGadgets->setOwnerId($oUserFirst->getId());
$oBlogGadgets->setTitle("Gadgets");
$oBlogGadgets->setDescription('Offers latest gadget reviews');
$oBlogGadgets->setType('open');

View file

@ -5,6 +5,7 @@ require_once(realpath((dirname(__FILE__)) . "/../AbstractFixtures.php"));
class TopicFixtures extends AbstractFixtures
{
protected $aActivePlugins = array();
public static function getOrder()
{
return 2;
@ -12,23 +13,23 @@ class TopicFixtures extends AbstractFixtures
public function load()
{
$oUserGolfer = $this->getReference('user-golfer');
$oUserFirst = $this->getReference('user-golfer');
$oBlogGadgets = $this->getReference('blog-gadgets');
$oTopicToshiba = $this->_createTopic($oBlogGadgets->getBlogId(), $oUserGolfer->getId(),
$oTopicToshiba = $this->_createTopic($oBlogGadgets->getBlogId(), $oUserFirst->getId(),
'Toshiba unveils 13.3-inch AT330 Android ICS 4.0 tablet',
'Toshiba is to add a new Android 4.0 ICS to the mass which is known as Toshiba AT330. The device is equipped with a multi-touch capacitive touch display that packs a resolution of 1920 x 1200 pixels. The Toshiba AT330 tablet is currently at its prototype stage. We have very little details about the tablet, knowing that itll come equipped with HDMI port, on-board 32GB storage thats expandable via an full-sized SD card slot. Itll also have a built-in TV tuner and a collapsible antenna.Itll also run an NVIDIA Tegra 3 quad-core processor. Other goodies will be a 1.3MP front-facing camera and a 5MP rear-facing camera. Currently, there is no information about its price and availability. A clip is included below showing it in action.',
'gadget', '2012-10-21 00:10:20');
$this->addReference('topic-toshiba', $oTopicToshiba);
$oTopicIpad = $this->_createTopic($oBlogGadgets->getBlogId(), $oUserGolfer->getId(),
$oTopicIpad = $this->_createTopic($oBlogGadgets->getBlogId(), $oUserFirst->getId(),
'iPad 3 rumored to come this March with quad-core chip and 4G LTE',
'Another rumor for the iPad 3 has surfaced with some details given by Bloomberg, claiming that the iPad 3 production is already underway and will be ready for a launch as early as March.',
'apple, ipad', '2012-10-21 1:20:30');
$this->addReference('topic-ipad', $oTopicIpad);
$oPersonalBlogGolfer = $this->oEngine->Blog_GetPersonalBlogByUserId($oUserGolfer->getId());
$oTopicSony = $this->_createTopic($oPersonalBlogGolfer->getBlogId(), $oUserGolfer->getId(),
$oPersonalBlogGolfer = $this->oEngine->Blog_GetPersonalBlogByUserId($oUserFirst->getId());
$oTopicSony = $this->_createTopic($oPersonalBlogGolfer->getBlogId(), $oUserFirst->getId(),
'Sony MicroVault Mach USB 3.0 flash drive',
'Want more speeds and better protection for your data? The Sony MicroVault Mach flash USB 3.0 drive is what you need. It offers the USB 3.0 interface that delivers data at super high speeds of up to 5Gbps. Its also backward compatible with USB 2.0.',
'sony, flash, gadget', '2012-10-21 2:30:40');
@ -49,6 +50,8 @@ class TopicFixtures extends AbstractFixtures
*/
private function _createTopic($iBlogId, $iUserId, $sTitle, $sText, $sTags, $sDate)
{
$this->aActivePlugins = $this->oEngine->Plugin_GetActivePlugins();
$oTopic = Engine::GetEntity('Topic');
/* @var $oTopic ModuleTopic_EntityTopic */
$oTopic->setBlogId($iBlogId);
@ -70,6 +73,13 @@ class TopicFixtures extends AbstractFixtures
$oTopic->setTextHash(md5($oTopic->getType() . $oTopic->getTextSource() . $oTopic->getTitle()));
$oTopic->setTags($sTags);
//with active plugin l10n added a field topic_lang
if (in_array('l10n', $this->aActivePlugins)) {
$oTopic->setTopicLang(Config::Get('lang.current'));
}
// @todo refact this
$oTopic->_setValidateScenario('topic');
$oTopic->_Validate();
$this->oEngine->Topic_AddTopic($oTopic);

View file

@ -11,26 +11,57 @@ class UserFixtures extends AbstractFixtures
public function load()
{
$oUserFirst = $this->_createUser('user-golfer', 'qwerty','user_first@info.com', '2012-11-1 00:10:20');
$oUserGolfer = Engine::GetEntity('User');
$oUserGolfer->setLogin('golfer');
$oUserGolfer->setPassword(md5('qwerty'));
$oUserGolfer->setMail('golfer@gmail.com');
$oUserFirst->setProfileName('Golfer FullName');
$oUserFirst->setProfileAbout('... Golfer profile description');
$oUserFirst->setProfileSex('man');
$oUserGolfer->setUserDateRegister(date("Y-m-d H:i:s")); // @todo freeze
$oUserGolfer->setUserIpRegister('127.0.0.1');
$oUserGolfer->setUserActivate('1');
$oUserGolfer->setUserActivateKey('0');
$this->oEngine->User_Update($oUserFirst);
$this->addReference('user-golfer', $oUserFirst);
$this->oEngine->User_Add($oUserGolfer);
$oUserFriend = $this->_createUser('user-friend', 'qwerty','user_friend@info.com', '2012-11-1 10:20:30');
$oUserFriend->setProfileName('Friend FullName');
$oUserFriend->setProfileAbout('... Friend profile description');
$oUserFriend->setProfileSex('man');
$oUserGolfer->setProfileName('Sergey Doryba');
$oUserGolfer->setProfileAbout('... Sergey Doryba profile description');
$oUserGolfer->setProfileSex('man');
$this->oEngine->User_Update($oUserFriend);
$this->addReference('user-friend', $oUserFriend);
$friend = $this->oEngine->GetEntity('User_Friend');
$friend->setUserFrom($oUserFirst->getId());
$friend->setUserTo($oUserFriend->getId());
$friend->setStatusFrom(1);
$friend->setStatusTo(2);
$this->oEngine->User_AddFriend($friend);
$this->oEngine->User_Update($oUserGolfer);
$this->addReference('user-golfer', $oUserGolfer);
}
}
/**
* Create user with default values
*
* @param string $sUserName
* @param string $sPassword
* @param string $sMail
* @param string $sDate
*
* @return ModuleTopic_EntityUser
*/
private function _createUser($sUserName, $sPassword,$sMail,$sDate)
{
$oUser = Engine::GetEntity('User');
$oUser->setLogin($sUserName);
$oUser->setPassword(md5($sPassword));
$oUser->setMail($sMail);
$oUser->setUserDateRegister($sDate);
$oUser->setUserIpRegister('127.0.0.1');
$oUser->setUserActivate('1');
$oUser->setUserActivateKey('0');
$this->oEngine->User_Add($oUser);
return $oUser;
}
}

45
tests/fixtures/sql/insert.sql vendored Normal file
View file

@ -0,0 +1,45 @@
-- --------------------------------------------------------
--
-- Дамп данных таблицы `prefix_user`
--
INSERT INTO `prefix_user` (`user_id`, `user_login`, `user_password`, `user_mail`, `user_skill`, `user_date_register`, `user_date_activate`, `user_date_comment_last`, `user_ip_register`, `user_rating`, `user_count_vote`, `user_activate`, `user_activate_key`, `user_profile_name`, `user_profile_sex`, `user_profile_country`, `user_profile_region`, `user_profile_city`, `user_profile_birthday`, `user_profile_about`, `user_profile_date`, `user_profile_avatar`, `user_profile_foto`, `user_settings_notice_new_topic`, `user_settings_notice_new_comment`, `user_settings_notice_new_talk`, `user_settings_notice_reply_comment`, `user_settings_notice_new_friend`, `user_settings_timezone`) VALUES
(1, 'admin', 'd8578edf8458ce06fbc5bb76a58c5ca4', 'admin@admin.adm', 0.000, '2012-10-1 00:00:00', NULL, NULL, '127.0.0.1', 0.000, 0, 1, NULL, NULL, 'other', NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, 1, 1, 1, 1, 1, NULL);
-- --------------------------------------------------------
--
-- Дамп данных таблицы `prefix_user_administrator`
--
INSERT INTO `prefix_user_administrator` (`user_id`) VALUES
(1);
-- --------------------------------------------------------
--
-- Дамп данных таблицы `prefix_user_field`
--
INSERT INTO `prefix_user_field` (`id`, `type`, `name`, `title`, `pattern`) VALUES
(1, 'contact', 'phone', 'Телефон', ''),
(2, 'contact', 'mail', 'E-mail', '<a href="mailto:{*}" rel="nofollow">{*}</a>'),
(3, 'contact', 'skype', 'Skype', '<a href="skype:{*}" rel="nofollow">{*}</a>'),
(4, 'contact', 'icq', 'ICQ', '<a href="http://www.icq.com/people/about_me.php?uin={*}" rel="nofollow">{*}</a>'),
(5, 'contact', 'www', 'Сайт', '<a href="http://{*}" rel="nofollow">{*}</a>'),
(6, 'social', 'twitter', 'Twitter', '<a href="http://twitter.com/{*}/" rel="nofollow">{*}</a>'),
(7, 'social', 'facebook', 'Facebook', '<a href="http://facebook.com/{*}" rel="nofollow">{*}</a>'),
(8, 'social', 'vkontakte', 'ВКонтакте', '<a href="http://vk.com/{*}" rel="nofollow">{*}</a>'),
(9, 'social', 'odnoklassniki', 'Одноклассники', '<a href="http://www.odnoklassniki.ru/profile/{*}/" rel="nofollow">{*}</a>');
-- --------------------------------------------------------
--
-- Дамп данных таблицы `prefix_blog`
--
INSERT INTO `prefix_blog` (`blog_id`, `user_owner_id`, `blog_title`, `blog_description`, `blog_type`, `blog_date_add`, `blog_date_edit`, `blog_rating`, `blog_count_vote`, `blog_count_user`, `blog_count_topic`, `blog_limit_rating_topic`, `blog_url`, `blog_avatar`) VALUES
(1, 1, 'Blog by admin', 'This is Admin personal blog.', 'personal', '2012-11-07 09:20:00', NULL, 0.000, 0, 0, 0, -1000.000, NULL, '0');