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
11c1bf61
Commit
11c1bf61
authored
Jul 02, 2018
by
Георгий Попов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change db structure a bit. Rename comment to corrected and add new column comment
parent
ec1c618b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
0.addCommentColumn.sql
migrations/0.addCommentColumn.sql
+9
-0
server.php
server.php
+5
-3
No files found.
migrations/0.addCommentColumn.sql
0 → 100644
View file @
11c1bf61
/* Теперь comment столбец называется corrected. А новый столбец comment отвечает за комментарий
пользователя, который посылается вместе с исправлением. */
ALTER
TABLE
`messages`
CHANGE
`comment`
`corrected`
VARCHAR
(
255
)
CHARACTER
SET
utf8
COLLATE
utf8_general_ci
NOT
NULL
COMMENT
'Correct variant of a text'
;
ALTER
TABLE
`messages`
ADD
`comment`
VARCHAR
(
255
)
NULL
DEFAULT
NULL
COMMENT
'Optional user message'
AFTER
`corrected`
;
\ No newline at end of file
server.php
View file @
11c1bf61
...
...
@@ -25,6 +25,7 @@ $error = '';
$userdata
=
array
(
'url'
=>
''
,
'text'
=>
''
,
'corrected'
=>
''
,
'context'
=>
''
,
'comment'
=>
''
,
'old_browser'
=>
0
...
...
@@ -64,6 +65,7 @@ if (!validate()) {
//TODO - работу со старыми бразуерами будем подерживать или нет? Если будем, то надо доработать работу на стороне сервера (закрытие окна)
$userdata
[
'old_browser'
]
=
getRequest
(
'old_browser'
,
0
);
$userdata
[
'comment'
]
=
htmlspecialchars
(
rawurldecode
(
getRequest
(
'comment'
,
''
)));
$userdata
[
'corrected'
]
=
htmlspecialchars
(
rawurldecode
(
getRequest
(
'corrected'
,
''
)));
$userdata
[
'url'
]
=
getFormatingUrl
(
rawurldecode
(
getRequest
(
'url'
,
''
)));
$userdata
[
'text'
]
=
htmlspecialchars
(
rawurldecode
(
getRequest
(
'text'
,
''
)));
$userdata
[
'context'
]
=
htmlspecialchars
(
rawurldecode
(
getRequest
(
'context'
,
''
)));
...
...
@@ -123,8 +125,8 @@ try {
/* Если активных пользователей за сайт нет, то возвращаем сообщение об ошибке */
if
(
$email_users
)
{
try
{
$data
=
array
(
null
,
$email_users
[
0
][
'id_site'
],
$userdata
[
'url'
],
$userdata
[
'text'
],
$userdata
[
'context'
],
$userdata
[
'comment'
],
0
);
$STH
=
$DBH
->
prepare
(
"INSERT INTO messages (id, site_id, link, text, context, co
mment, date, status) VALUES (
?, ?, ?, ?, ?, ?, DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s'), ?)"
);
$data
=
array
(
null
,
$email_users
[
0
][
'id_site'
],
$userdata
[
'url'
],
$userdata
[
'text'
],
$userdata
[
'context'
],
$userdata
[
'co
rrected'
],
$userdata
[
'co
mment'
],
0
);
$STH
=
$DBH
->
prepare
(
"INSERT INTO messages (id, site_id, link, text, context, co
rrected, comment, date, status) VALUES (?,
?, ?, ?, ?, ?, ?, DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s'), ?)"
);
$result
=
$STH
->
execute
(
$data
);
if
(
$result
!==
true
)
{
...
...
@@ -147,7 +149,7 @@ if ($email_users) {
$message_email
.=
"<p>"
.
$_language
[
$code_language
][
'mail_url'
]
.
" <a href="
.
htmlspecialchars
(
$userdata
[
'url'
])
.
">"
.
$_language
[
$code_language
][
'mail_click_url'
]
.
"</a>"
.
" ("
.
$userdata
[
'url'
]
.
")"
.
"</p>"
;
$message_email
.=
"<p> <a href='
{
$controlPanelUrl
}
'>
{
$_language
[
$code_language
][
'mail_cp_link'
]
}
</a></p>"
;
$message_email
.=
"<p>
{
$_language
[
$code_language
][
'mail_text'
]
}
: <i>
{
$userdata
[
'text'
]
}
</i></p>"
;
$message_email
.=
"<p>
{
$_language
[
$code_language
][
'mail_comment'
]
}
: <i>
{
$userdata
[
'co
mment
'
]
}
</i></p>"
;
$message_email
.=
"<p>
{
$_language
[
$code_language
][
'mail_comment'
]
}
: <i>
{
$userdata
[
'co
rrected
'
]
}
</i></p>"
;
$message_email
.=
"<p>
{
$_language
[
$code_language
][
'mail_context'
]
}
:
\"
{
$userdata
[
'context'
]
}
\"
</p>"
;
$subject
=
'=?utf-8?B?'
.
base64_encode
(
$_language
[
$code_language
][
'mail_subject'
])
.
'?='
;
...
...
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