Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-webclient
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
0
Merge Requests
0
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-webclient
Commits
9c6c713f
Commit
9c6c713f
authored
May 15, 2012
by
Владислав Большаков
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
barbass: убрано ис-ие email пользователя
parent
1252d405
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
39 deletions
+41
-39
default.php
default.php
+3
-2
etersoft_typos2.js
etersoft_typos2.js
+32
-14
server.php
server.php
+6
-23
No files found.
default.php
View file @
9c6c713f
...
...
@@ -28,7 +28,7 @@
.activeField
{
background-color
:
#ffffff
!important
;
border
:
solid
1px
#c1bf1d
;
border
:
1px
solid
#f01717
;
}
.idle
{
...
...
@@ -57,10 +57,11 @@
<div
id=
"e_typos_div"
>
<p>
Выделите текст и нажмите кнопку "Отправить"
</p>
<p>
<nobr>
e-mail:
<input
type=
"email"
id=
"e_typos_email"
name=
"e_typos_email"
class=
"idle"
onblur=
"this.className='idle'"
onfocus=
"this.className='activeField'"
size=
'19'
maxlength=
"50"
placeholder=
"my@email.com"
/></nobr>
<nobr>
Комментарий:
<input
type=
"text"
id=
"e_typos_comment"
name=
"e_typos_comment"
class=
"idle"
onblur=
"this.className='idle'"
onfocus=
"this.className='activeField'"
size=
'19'
maxlength=
"50"
placeholder=
"Должна быть буква..."
/></nobr>
</p>
<!--<p id="e_typos_user_text" class="e_typos_user_text"></p>-->
<p
id=
"e_typos_error"
class=
"e_typos_error"
style=
"border:1px solid"
></p>
<input
type=
"button"
value=
"Отправить"
class=
"idle"
onblur=
"this.className='idle'"
onmouseup=
"this.className='idle'"
onmousedown=
"this.className='activeButton'"
onclick=
"ETY.post_data();"
/>
...
...
etersoft_typos2.js
View file @
9c6c713f
...
...
@@ -15,12 +15,25 @@ window.document.onkeydown = function(e) {
var
ETY
=
{
time
:
0
,
//время последнего запроса
server_url
:
"http://barbass.pubsandbox.eterhost.ru/typos/server.php"
,
select_text
:
""
,
//Выделенный текст
get_select_text
:
function
()
{
ETY
.
select_text
=
String
(
window
.
getSelection
()).
trim
().
substr
(
0
,
50
);
if
(
typeof
(
ETY
.
select_text
)
==
'undefined'
)
{
ETY
.
select_text
=
""
;
}
},
control_panel
:
function
()
{
if
(
document
.
getElementById
(
"e_typos_div"
).
style
.
display
==
"block"
)
{
this
.
close
();
}
else
{
this
.
div
();
/*ETY.get_select_text();
if (ETY.select_text != "") {
ETY.text(ETY.select_text);
}*/
}
},
...
...
@@ -32,6 +45,7 @@ var ETY = {
document
.
getElementById
(
"e_typos_div"
).
style
.
left
=
left
+
"px"
;
document
.
getElementById
(
"e_typos_error"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"e_typos_user_text"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"e_typos_comment"
).
value
=
""
;
document
.
getElementById
(
"e_typos_div"
).
style
.
display
=
"block"
;
...
...
@@ -43,30 +57,29 @@ var ETY = {
post_data
:
function
()
{
var
this_url
=
window
.
location
.
href
;
//Текущая страница
var
select_text
=
String
(
window
.
getSelection
()).
trim
();
//Выделенный текст
var
user_email
=
document
.
getElementById
(
"e_typos_email"
).
value
.
trim
().
substr
(
0
,
50
);
if
(
user_email
==
''
)
{
user_email
=
""
;
}
else
{
if
(
!
/^
([
a-z0-9_-
]
+
\.)
*
[
a-z0-9_-
]
+@
[
a-z0-9_-
]
+
(\.[
a-z0-9_-
]
+
)
*
\.[
a-z
]{2,4}
$/
.
test
(
user_email
))
{
this
.
error
(
"red"
,
"e-mail некорректен"
);
return
false
;
}
}
ETY
.
get_select_text
();
post_text
=
ETY
.
select_text
;
/*if (post_text.length == 0) {
ETY.get_select_text();
post_text = ETY.select_text;
}*/
//Выделенный текст
var
user_comment
=
document
.
getElementById
(
"e_typos_comment"
).
value
.
trim
().
substr
(
0
,
50
);
if
(
user_comment
==
''
)
{
user_comment
=
""
;
}
if
(
selec
t_text
.
length
==
0
)
{
if
(
pos
t_text
.
length
==
0
)
{
this
.
error
(
"red"
,
"Вы ничего не выделили"
);
}
else
if
(
selec
t_text
.
length
<
5
)
{
}
else
if
(
pos
t_text
.
length
<
5
)
{
this
.
error
(
"red"
,
"Выделенный текст слишком короток"
);
}
else
if
(
selec
t_text
.
length
>
30
)
{
}
else
if
(
pos
t_text
.
length
>
30
)
{
this
.
error
(
"red"
,
"Выделенный текст слишком длинный"
);
}
else
{
//ETY.text(post_text);
//Ajax-запрос
this
.
ajax_query
(
this
.
server_url
+
"?url="
+
this_url
+
"&
email="
+
user_email
+
"&comment="
+
user_comment
+
"&error_text="
+
selec
t_text
);
this
.
ajax_query
(
this
.
server_url
+
"?url="
+
this_url
+
"&
comment="
+
user_comment
+
"&error_text="
+
pos
t_text
);
}
},
...
...
@@ -136,6 +149,11 @@ var ETY = {
document
.
getElementById
(
"e_typos_error"
).
style
.
color
=
color
;
document
.
getElementById
(
"e_typos_error"
).
style
.
borderColor
=
color
;
},
text
:
function
(
text
)
{
document
.
getElementById
(
"e_typos_user_text"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"e_typos_user_text"
).
innerHTML
=
"Ваш текст: "
+
text
;
},
timer
:
function
()
{
var
sec
=
this
.
now_time
();
...
...
server.php
View file @
9c6c713f
...
...
@@ -8,7 +8,7 @@ header('Access-Control-Allow-Origin: *');
require_once
(
'configuration.php'
);
try
{
$DBH
=
new
PDO
(
"mysql:host=
$db_host
;dbname=
$db_name
"
,
$db_user
,
$db_pass
);
$DBH
=
new
PDO
(
"mysql:host=
$db_host
;dbname=
$db_name
"
,
$db_user
,
$db_pass
,
array
(
PDO
::
MYSQL_ATTR_INIT_COMMAND
=>
'SET NAMES \'UTF8\''
)
);
}
catch
(
PDOException
$e
)
{
$ajax_mess
=
"10servererror"
;
echo
(
$ajax_mess
);
...
...
@@ -29,18 +29,6 @@ if (check_header() === 0 || get_ip() === 0) {
exit
;
}
if
(
!
isset
(
$_REQUEST
[
'email'
]))
{
$email
=
''
;
}
else
{
$email
=
trim
(
htmlspecialchars
(
substr
(
$_REQUEST
[
'email'
],
0
,
50
)));
if
(
$email
!=
''
)
{
if
(
!
preg_match
(
"/^([a-z0-9_-]+\.)*[a-z0-9_-]+@[a-z0-9_-]+(\.[a-z0-9_-]+)*\.[a-z]
{
2,4
}
$/"
,
$email
))
{
$ajax_mess
=
"10dataerror"
;
echo
(
$ajax_mess
);
exit
;
}
}
}
if
(
!
isset
(
$_REQUEST
[
'comment'
]))
{
$comment
=
''
;
}
else
{
...
...
@@ -63,7 +51,6 @@ if (check_header() === 0 || get_ip() === 0) {
exit
;
}
////////////////////////////////////////////////////////////////////////
...
...
@@ -99,7 +86,8 @@ try {
}
if
(
$email_users
!==
0
)
{
try
{
$data
=
array
(
'NULL'
,
$email_users
[
0
][
'site'
],
$url
,
$error_text
,
$email
,
$comment
,
0
);
//FIXED !!!удалить из таблицы поле email
$data
=
array
(
'NULL'
,
$email_users
[
0
][
'site'
],
$url
,
$error_text
,
'NULL'
,
$comment
,
0
);
$STH
=
$DBH
->
prepare
(
"INSERT INTO messages (id, id_site, link, error_text, email, comment, datetime, status) VALUES (?, ?, ?, ?, ?, ?, DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s'), ?)"
);
$STH
->
execute
(
$data
);
}
catch
(
PDOException
$e
)
{
...
...
@@ -108,9 +96,6 @@ if ($email_users !== 0) {
exit
;
}
if
(
$email
==
''
)
{
$email
=
'Пользователь не оставил e-mail'
;
}
if
(
$comment
==
''
)
{
$comment
=
'Пользователь не оставил комментарий'
;
}
...
...
@@ -118,13 +103,11 @@ if ($email_users !== 0) {
$message_email
=
"<p>Сайт: "
.
$mas_url
[
"host"
]
.
"</p>"
;
$message_email
.=
"<p>Ссылка: <a href=
$url
>нажмите</a>"
.
" ("
.
$url
.
")"
.
"</p>"
;
$message_email
.=
"<p>Текст с опечаткой: "
.
$error_text
.
"</p>"
;
$message_email
.=
"<p>e-mail пользователя: "
.
$email
.
"</p>"
;
$message_email
.=
"<p>Комментарий: "
.
$comment
.
"</p>"
;
$subject
=
'=?utf-8?B?'
.
base64_encode
(
"Сообщение об опечатке"
)
.
'?='
;
/*FIXED !!!!!!!!*/
$to
=
$email
;
//to_email($email_users);
$to
=
to_email
(
$email_users
);
/*FIXED какая почта?*/
$from_email
=
"typos@etersoft.ru"
;
$from_name
=
'=?utf-8?B?'
.
base64_encode
(
"Служба опечаток Etersoft"
)
.
'?='
;
...
...
@@ -146,7 +129,7 @@ if ($email_users !== 0) {
}
////////////////////////////////////////////////////////////////////////
//Вспомогательные функции
\\
//Вспомогательные функции
//Отправка email-ов
function
sendmail
(
$subject
,
$body
,
$to
,
$from_email
,
$from_name
,
$type
=
'plain'
)
{
...
...
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