Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-server
Commits
d21722aa
Commit
d21722aa
authored
Feb 21, 2022
by
Soldatoff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Доработал обработку стоп-слов
parent
c087ed87
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
server.php
server.php
+2
-9
stopwords.php
stopwords.php
+14
-0
No files found.
server.php
View file @
d21722aa
...
@@ -15,6 +15,7 @@ require_once('functions.php');
...
@@ -15,6 +15,7 @@ require_once('functions.php');
require_once
(
'dbfunctions.php'
);
require_once
(
'dbfunctions.php'
);
require_once
(
'language.php'
);
require_once
(
'language.php'
);
require_once
(
'constants.php'
);
require_once
(
'constants.php'
);
require_once
(
'stopwords.php'
);
/* Начинаем сессию */
/* Начинаем сессию */
if
(
!
session_id
())
{
if
(
!
session_id
())
{
...
@@ -78,15 +79,7 @@ if (!isset($mas_url['host'])) {
...
@@ -78,15 +79,7 @@ if (!isset($mas_url['host'])) {
}
}
/* Проверка на стоп слова */
/* Проверка на стоп слова */
$i
=
0
;
if
(
stopwords
(
$userdata
)){
$stopwords
=
explode
(
"
\r\n
"
,
(
file_get_contents
(
"stopwords.txt"
)));
foreach
(
$stopwords
as
$word
){
$pos
=
in_array
(
$word
,
$userdata
,
true
);
if
(
$pos
!==
false
){
$i
++
;
}
}
if
(
$i
>
0
){
$error
=
"«Никакое гнилое слово да не исходит из уст ваших, а только доброе для назидания в вере, дабы оно доставляло благодать слушающим.» (Еф.4:29)"
;
$error
=
"«Никакое гнилое слово да не исходит из уст ваших, а только доброе для назидания в вере, дабы оно доставляло благодать слушающим.» (Еф.4:29)"
;
echoJsonData
(
array
(
'success'
=>
'false'
,
'message'
=>
$error
));
echoJsonData
(
array
(
'success'
=>
'false'
,
'message'
=>
$error
));
return
false
;
return
false
;
...
...
stopwords.php
0 → 100644
View file @
d21722aa
<?php
function
stopwords
(
$userdata
)
{
/* Проверка на стоп слова */
$stopwords
=
explode
(
"
\r\n
"
,
(
file_get_contents
(
"stopwords.txt"
)));
$alldata
=
explode
(
' '
,
implode
(
' '
,
$userdata
));
foreach
(
$alldata
as
$word
){
$pos
=
(
in_array
(
strtolower
(
$word
),
$stopwords
,
true
));
if
(
$pos
==
true
){
return
true
;
}
}
return
false
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment