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
8f32c39d
Commit
8f32c39d
authored
Aug 28, 2005
by
Dries
Browse files
- Patch
#29102
by chx: fixed bug in forum module and tidied up the taxonomy_save_*() functions.
parent
c9fc300b
Changes
4
Hide whitespace changes
Inline
Side-by-side
modules/forum.module
View file @
8f32c39d
...
...
@@ -91,27 +91,38 @@ function forum_admin() {
break
;
}
else
{
$name
=
$edit
[
'name'
];
$edit
[
'name'
]
=
0
;
}
case
t
(
'Submit'
)
:
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_term
(
$edit
)
)
;
$status
=
taxonomy_save_term
(
$edit
);
if
(
arg
(
3
)
==
'container'
)
{
$containers
=
variable_get
(
'forum_containers'
,
array
());
$containers
[]
=
$edit
[
'tid'
];
variable_set
(
'forum_containers'
,
$containers
);
if
(
$status
==
SAVED_NEW
)
{
drupal_set_message
(
t
(
'Created new forum container %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
}
else
{
drupal_set_message
(
t
(
'The forum container %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
switch
(
$status
)
{
case
SAVED_NEW
:
$containers
=
variable_get
(
'forum_containers'
,
array
());
$containers
[]
=
$edit
[
'tid'
];
variable_set
(
'forum_containers'
,
$containers
);
drupal_set_message
(
t
(
'Created new forum container %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_UPDATED
:
drupal_set_message
(
t
(
'The forum container %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_UPDATED
:
drupal_set_message
(
t
(
'The forum container %term has been deleted.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$name
))));
break
;
}
}
else
{
if
(
$status
==
SAVED_NEW
)
{
drupal_set_message
(
t
(
'Created new forum %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
}
else
{
drupal_set_message
(
t
(
'The forum %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
switch
(
$status
)
{
case
SAVED_NEW
:
drupal_set_message
(
t
(
'Created new forum %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_UPDATED
:
drupal_set_message
(
t
(
'The forum %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_DELETED
:
drupal_set_message
(
t
(
'The forum %term has been deleted.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$name
))));
break
;
}
}
drupal_goto
(
'admin/forum'
);
...
...
@@ -293,8 +304,9 @@ function _forum_get_vid() {
// Check to see if a forum vocabulary exists
$vid
=
db_result
(
db_query
(
"SELECT vid FROM
{
vocabulary
}
WHERE module='%s'"
,
'forum'
));
if
(
!
$vid
)
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_vocabulary
(
array
(
'name'
=>
'Forums'
,
'multiple'
=>
0
,
'required'
=>
1
,
'hierarchy'
=>
1
,
'relations'
=>
0
,
'module'
=>
'forum'
,
'nodes'
=>
array
(
'forum'
))));
$vid
=
$object
[
'vid'
];
$edit
=
array
(
'name'
=>
'Forums'
,
'multiple'
=>
0
,
'required'
=>
1
,
'hierarchy'
=>
1
,
'relations'
=>
0
,
'module'
=>
'forum'
,
'nodes'
=>
array
(
'forum'
));
taxonomy_save_vocabulary
(
$edit
);
$vid
=
$edit
[
'vid'
];
}
variable_set
(
'forum_nav_vocabulary'
,
$vid
);
}
...
...
modules/forum/forum.module
View file @
8f32c39d
...
...
@@ -91,27 +91,38 @@ function forum_admin() {
break
;
}
else
{
$name
=
$edit
[
'name'
];
$edit
[
'name'
]
=
0
;
}
case
t
(
'Submit'
)
:
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_term
(
$edit
)
)
;
$status
=
taxonomy_save_term
(
$edit
);
if
(
arg
(
3
)
==
'container'
)
{
$containers
=
variable_get
(
'forum_containers'
,
array
());
$containers
[]
=
$edit
[
'tid'
];
variable_set
(
'forum_containers'
,
$containers
);
if
(
$status
==
SAVED_NEW
)
{
drupal_set_message
(
t
(
'Created new forum container %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
}
else
{
drupal_set_message
(
t
(
'The forum container %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
switch
(
$status
)
{
case
SAVED_NEW
:
$containers
=
variable_get
(
'forum_containers'
,
array
());
$containers
[]
=
$edit
[
'tid'
];
variable_set
(
'forum_containers'
,
$containers
);
drupal_set_message
(
t
(
'Created new forum container %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_UPDATED
:
drupal_set_message
(
t
(
'The forum container %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_UPDATED
:
drupal_set_message
(
t
(
'The forum container %term has been deleted.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$name
))));
break
;
}
}
else
{
if
(
$status
==
SAVED_NEW
)
{
drupal_set_message
(
t
(
'Created new forum %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
}
else
{
drupal_set_message
(
t
(
'The forum %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
switch
(
$status
)
{
case
SAVED_NEW
:
drupal_set_message
(
t
(
'Created new forum %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_UPDATED
:
drupal_set_message
(
t
(
'The forum %term has been updated.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
case
SAVED_DELETED
:
drupal_set_message
(
t
(
'The forum %term has been deleted.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$name
))));
break
;
}
}
drupal_goto
(
'admin/forum'
);
...
...
@@ -293,8 +304,9 @@ function _forum_get_vid() {
// Check to see if a forum vocabulary exists
$vid
=
db_result
(
db_query
(
"SELECT vid FROM
{
vocabulary
}
WHERE module='%s'"
,
'forum'
));
if
(
!
$vid
)
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_vocabulary
(
array
(
'name'
=>
'Forums'
,
'multiple'
=>
0
,
'required'
=>
1
,
'hierarchy'
=>
1
,
'relations'
=>
0
,
'module'
=>
'forum'
,
'nodes'
=>
array
(
'forum'
))));
$vid
=
$object
[
'vid'
];
$edit
=
array
(
'name'
=>
'Forums'
,
'multiple'
=>
0
,
'required'
=>
1
,
'hierarchy'
=>
1
,
'relations'
=>
0
,
'module'
=>
'forum'
,
'nodes'
=>
array
(
'forum'
));
taxonomy_save_vocabulary
(
$edit
);
$vid
=
$edit
[
'vid'
];
}
variable_set
(
'forum_nav_vocabulary'
,
$vid
);
}
...
...
modules/taxonomy.module
View file @
8f32c39d
...
...
@@ -131,7 +131,7 @@ function taxonomy_form_vocabulary($edit = array()) {
return
form
(
$form
);
}
function
taxonomy_save_vocabulary
(
$edit
)
{
function
taxonomy_save_vocabulary
(
&
$edit
)
{
$edit
[
'nodes'
]
=
(
$edit
[
'nodes'
])
?
$edit
[
'nodes'
]
:
array
();
$edit
[
'weight'
]
=
(
$edit
[
'weight'
])
?
$edit
[
'weight'
]
:
0
;
...
...
@@ -160,7 +160,7 @@ function taxonomy_save_vocabulary($edit) {
cache_clear_all
();
return
array
(
'status'
=>
$status
,
'object'
=>
$edit
)
;
return
$status
;
}
function
taxonomy_del_vocabulary
(
$vid
)
{
...
...
@@ -246,7 +246,7 @@ function taxonomy_form_term($edit = array()) {
return
form
(
$form
);
}
function
taxonomy_save_term
(
$edit
)
{
function
taxonomy_save_term
(
&
$edit
)
{
if
(
$edit
[
'tid'
]
&&
$edit
[
'name'
])
{
$data
=
array
(
'name'
=>
$edit
[
'name'
],
'description'
=>
$edit
[
'description'
],
'weight'
=>
$edit
[
'weight'
]);
...
...
@@ -302,7 +302,7 @@ function taxonomy_save_term($edit) {
cache_clear_all
();
return
array
(
'status'
=>
$status
,
'object'
=>
$edit
)
;
return
$status
;
}
function
taxonomy_del_term
(
$tid
)
{
...
...
@@ -603,8 +603,9 @@ function taxonomy_node_save($nid, $terms) {
}
if
(
!
$typed_term_tid
)
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_term
(
array
(
'vid'
=>
$vid
,
'name'
=>
$typed_term
)));
$typed_term_tid
=
$object
[
'tid'
];
$edit
=
array
(
'vid'
=>
$vid
,
'name'
=>
$typed_term
);
$status
=
taxonomy_save_term
(
$edit
);
$typed_term_tid
=
$edit
[
'tid'
];
}
db_query
(
'INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)'
,
$nid
,
$typed_term_tid
);
...
...
@@ -1155,8 +1156,7 @@ function taxonomy_admin() {
}
case
t
(
'Submit'
)
:
if
(
arg
(
3
)
==
'vocabulary'
)
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_vocabulary
(
$edit
));
switch
(
$status
)
{
switch
(
taxonomy_save_vocabulary
(
$edit
))
{
case
SAVED_NEW
:
drupal_set_message
(
t
(
'Created new vocabulary %name.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
...
...
@@ -1169,8 +1169,7 @@ function taxonomy_admin() {
}
}
else
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_term
(
$edit
));
switch
(
$status
)
{
switch
(
taxonomy_save_term
(
$edit
))
{
case
SAVED_NEW
:
drupal_set_message
(
t
(
'Created new term %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
...
...
modules/taxonomy/taxonomy.module
View file @
8f32c39d
...
...
@@ -131,7 +131,7 @@ function taxonomy_form_vocabulary($edit = array()) {
return
form
(
$form
);
}
function
taxonomy_save_vocabulary
(
$edit
)
{
function
taxonomy_save_vocabulary
(
&
$edit
)
{
$edit
[
'nodes'
]
=
(
$edit
[
'nodes'
])
?
$edit
[
'nodes'
]
:
array
();
$edit
[
'weight'
]
=
(
$edit
[
'weight'
])
?
$edit
[
'weight'
]
:
0
;
...
...
@@ -160,7 +160,7 @@ function taxonomy_save_vocabulary($edit) {
cache_clear_all
();
return
array
(
'status'
=>
$status
,
'object'
=>
$edit
)
;
return
$status
;
}
function
taxonomy_del_vocabulary
(
$vid
)
{
...
...
@@ -246,7 +246,7 @@ function taxonomy_form_term($edit = array()) {
return
form
(
$form
);
}
function
taxonomy_save_term
(
$edit
)
{
function
taxonomy_save_term
(
&
$edit
)
{
if
(
$edit
[
'tid'
]
&&
$edit
[
'name'
])
{
$data
=
array
(
'name'
=>
$edit
[
'name'
],
'description'
=>
$edit
[
'description'
],
'weight'
=>
$edit
[
'weight'
]);
...
...
@@ -302,7 +302,7 @@ function taxonomy_save_term($edit) {
cache_clear_all
();
return
array
(
'status'
=>
$status
,
'object'
=>
$edit
)
;
return
$status
;
}
function
taxonomy_del_term
(
$tid
)
{
...
...
@@ -603,8 +603,9 @@ function taxonomy_node_save($nid, $terms) {
}
if
(
!
$typed_term_tid
)
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_term
(
array
(
'vid'
=>
$vid
,
'name'
=>
$typed_term
)));
$typed_term_tid
=
$object
[
'tid'
];
$edit
=
array
(
'vid'
=>
$vid
,
'name'
=>
$typed_term
);
$status
=
taxonomy_save_term
(
$edit
);
$typed_term_tid
=
$edit
[
'tid'
];
}
db_query
(
'INSERT INTO {term_node} (nid, tid) VALUES (%d, %d)'
,
$nid
,
$typed_term_tid
);
...
...
@@ -1155,8 +1156,7 @@ function taxonomy_admin() {
}
case
t
(
'Submit'
)
:
if
(
arg
(
3
)
==
'vocabulary'
)
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_vocabulary
(
$edit
));
switch
(
$status
)
{
switch
(
taxonomy_save_vocabulary
(
$edit
))
{
case
SAVED_NEW
:
drupal_set_message
(
t
(
'Created new vocabulary %name.'
,
array
(
'%name'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
...
...
@@ -1169,8 +1169,7 @@ function taxonomy_admin() {
}
}
else
{
list
(
$status
,
$object
)
=
array_values
(
taxonomy_save_term
(
$edit
));
switch
(
$status
)
{
switch
(
taxonomy_save_term
(
$edit
))
{
case
SAVED_NEW
:
drupal_set_message
(
t
(
'Created new term %term.'
,
array
(
'%term'
=>
theme
(
'placeholder'
,
$edit
[
'name'
]))));
break
;
...
...
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