Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
90db2c60
Commit
90db2c60
authored
Aug 16, 2001
by
Dries
Browse files
- fixed some bugs
parent
a7fc73ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
modules/account.module
View file @
90db2c60
...
...
@@ -147,15 +147,18 @@ function account_delete($name) {
function
account_form
(
$account
=
0
)
{
$form
.
=
$account
->
id
?
form_item
(
"ID"
,
$account
->
id
)
.
form_hidden
(
"id"
,
$account
->
id
)
:
""
;
$form
.
=
$account
->
userid
?
form_item
(
t
(
"
Usern
ame"
),
check_output
(
$account
->
userid
))
.
form_hidden
(
"userid"
,
$account
->
userid
)
:
form_textfield
(
t
(
"Username"
),
"userid"
,
$account
->
userid
,
15
,
15
);
$form
.
=
form_item
(
t
(
"
N
ame"
),
check_output
(
$account
->
name
)
.
" ("
.
check_output
(
$account
->
userid
)
.
")"
);
$form
.
=
form_select
(
t
(
"Status"
),
"status"
,
$account
->
status
,
array
(
"blocked"
,
"not confirmed"
,
"open"
));
$form
.
=
form_select
(
t
(
"Role"
),
"role"
,
$account
->
role
,
access_get_roles
());
$form
.
=
form_textfield
(
t
(
"Real name"
),
"name"
,
$account
->
name
,
30
,
55
);
$form
.
=
form_textfield
(
t
(
"Real e-mail address"
),
"real_email"
,
$account
->
real_email
,
30
,
55
);
$form
.
=
form_textfield
(
t
(
"Fake e-mail address"
),
"fake_email"
,
$account
->
fake_email
,
30
,
55
);
$form
.
=
form_textfield
(
t
(
"Homepage"
),
"url"
,
$account
->
url
,
30
,
55
);
$form
.
=
form_textarea
(
t
(
"Bio"
),
"bio"
,
$account
->
bio
,
35
,
5
);
$form
.
=
form_textarea
(
t
(
"Signature"
),
"signature"
,
$account
->
signature
,
35
,
5
);
$form
.
=
form_hidden
(
"userid"
,
$account
->
userid
);
$form
.
=
form_hidden
(
"name"
,
$account
->
name
);
if
(
$account
)
{
$form
.
=
form_submit
(
"View account"
);
}
...
...
@@ -168,7 +171,7 @@ function account_save($edit) {
if
(
$edit
[
id
])
{
// Updating existing account
foreach
(
$edit
as
$key
=>
$value
)
{
$query
[]
=
"
$key
= '"
.
addslashes
(
$value
)
.
"'"
;
$query
[]
=
"
$key
= '"
.
addslashes
(
$value
)
.
"'"
;
}
db_query
(
"UPDATE users SET "
.
implode
(
", "
,
$query
)
.
" WHERE id =
$edit[id]
"
);
watchdog
(
"account"
,
"account: modified user '
$edit[name]
'"
);
...
...
@@ -199,7 +202,7 @@ function account_save($edit) {
}
function
account_edit
(
$name
)
{
$result
=
db_query
(
"SELECT * FROM users WHERE
userid
= '
$name
'"
);
$result
=
db_query
(
"SELECT * FROM users WHERE
name
= '
$name
'"
);
if
(
$account
=
db_fetch_object
(
$result
))
{
return
account_form
(
$account
);
...
...
@@ -207,7 +210,39 @@ function account_edit($name) {
}
function
account_add
()
{
return
account_form
();
global
$REQUEST_URI
;
$form
.
=
form_textfield
(
"Username"
,
"name"
,
""
,
30
,
55
);
$form
.
=
form_textfield
(
"E-mail address"
,
"mail"
,
""
,
30
,
55
);
$form
.
=
form_textfield
(
"Password"
,
"pass"
,
""
,
30
,
55
);
$form
.
=
form_submit
(
"Create account"
);
return
form
(
$REQUEST_URI
,
$form
);
}
function
account_create
(
$edit
)
{
if
(
$error
=
user_validate_name
(
$edit
[
name
]))
{
return
$error
;
}
else
if
(
$error
=
user_validate_mail
(
$edit
[
mail
]))
{
return
$error
;
}
else
if
(
empty
(
$edit
[
pass
]))
{
return
"password should be non-empty."
;
}
else
if
(
db_num_rows
(
db_query
(
"SELECT userid FROM users WHERE (LOWER(userid) = LOWER('
$edit[name]
') OR LOWER(name) = LOWER('
$edit[name]
'))"
))
>
0
)
{
return
"the username '
$edit[name]
' is already taken."
;
}
else
if
(
db_num_rows
(
db_query
(
"SELECT real_email FROM users WHERE LOWER(real_email) = LOWER('
$edit[mail]
')"
))
>
0
)
{
return
"the e-mail address '
$edit[mail]
' is already in use by another account."
;
}
else
{
$user
=
user_save
(
""
,
array
(
"userid"
=>
$edit
[
name
],
"name"
=>
$edit
[
name
],
"real_email"
=>
$edit
[
mail
],
"passwd"
=>
$edit
[
pass
],
"role"
=>
"authenticated user"
,
"status"
=>
2
));
}
}
function
account_view
(
$name
)
{
...
...
@@ -222,10 +257,9 @@ function account_view($name) {
$output
.
=
"<TABLE BORDER=
\"
1
\"
CELLPADDING=
\"
3
\"
CELLSPACING=
\"
0
\"
>
\n
"
;
$output
.
=
" <TR><TH>ID:</TH><TD>
$account->id
</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Name:</TH><TD>
$account->name
</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Name:</TH><TD>
"
.
check_output
(
$account
->
name
)
.
" ("
.
check_output
(
$account
->
userid
)
.
")
</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Status:</TH><TD>"
.
$status
[
$account
->
status
]
.
"</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Role:</TH><TD>"
.
check_output
(
$account
->
role
)
.
"</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Real name:</TH><TD>"
.
check_output
(
$account
->
name
)
.
"</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Real e-mail address:</TH><TD>"
.
format_email
(
$account
->
real_email
)
.
"</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Fake e-mail address:</TH><TD>"
.
check_output
(
$account
->
fake_email
)
.
"</TD></TR>
\n
"
;
$output
.
=
" <TR><TH>Homepage:</TH><TD>"
.
format_url
(
$account
->
url
)
.
"</TD></TR>
\n
"
;
...
...
@@ -295,6 +329,15 @@ function account_admin() {
print
status
(
account_delete
(
$name
));
print
account_overview
(
account_query
(
$query
));
break
;
case
"Create account"
:
if
(
$error
=
account_create
(
$edit
))
{
print
status
(
$error
);
print
account_add
(
$edit
);
}
else
{
print
account_edit
(
$edit
[
name
]);
}
break
;
case
"add"
:
print
account_add
();
break
;
...
...
modules/meta.module
View file @
90db2c60
...
...
@@ -20,18 +20,26 @@ function meta_link($type) {
function
meta_form
(
$type
,
$edit
=
array
())
{
if
(
!
$edit
[
attributes
])
$edit
[
attributes
]
=
""
;
$c
=
db_query
(
"SELECT * FROM collection WHERE types LIKE '%"
.
check_input
(
$type
)
.
"%'"
);
while
(
$collection
=
db_fetch_object
(
$c
))
{
unset
(
$array
);
$t
=
db_query
(
"SELECT * FROM tag WHERE collections LIKE '%
$collection->name
%'"
);
while
(
$tag
=
db_fetch_object
(
$t
))
{
if
(
strstr
(
$edit
[
attributes
],
$tag
->
attributes
))
{
$edit
[
$collection
->
name
]
=
$tag
->
attributes
;
}
$array
[
$tag
->
attributes
]
=
$tag
->
name
;
}
$form
.
=
form_select
(
$collection
->
name
,
$collection
->
name
,
$edit
[
$collection
->
name
],
$array
);
}
return
$form
;
}
...
...
modules/node.module
View file @
90db2c60
...
...
@@ -376,7 +376,7 @@ function node_block() {
}
function
node_feed
()
{
$result
=
db_query
(
"SELECT nid, type FROM node WHERE promote = '1' AND status = '"
.
node_status
(
"posted"
)
.
"' ORDER BY timestamp DESC LIMIT 15"
);
while
(
$node
=
db_fetch_object
(
$result
))
{
...
...
modules/node/node.module
View file @
90db2c60
...
...
@@ -376,7 +376,7 @@ function node_block() {
}
function
node_feed
()
{
$result
=
db_query
(
"SELECT nid, type FROM node WHERE promote = '1' AND status = '"
.
node_status
(
"posted"
)
.
"' ORDER BY timestamp DESC LIMIT 15"
);
while
(
$node
=
db_fetch_object
(
$result
))
{
...
...
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