Skip to content
GitLab
Explore
Sign in
project
services
Compare revisions
6158ec3f6416213ec60fcabd2215c7ab17db039c to 6.x-2.x
Hide whitespace changes
Inline
Side-by-side
services/menu_service/menu_service.info
View file @
f110c123
; $Id$
core = "6.x"
dependencies[] = services
description = "Provides a menu service."
...
...
services/menu_service/menu_service.module
View file @
f110c123
<?php
// $Id$
/**
* @file
* Adds a service type for a menu
...
...
services/node_service/node_resource.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
...
...
@@ -30,7 +29,11 @@ function _node_resource_retrieve($nid) {
function
_node_resource_create
(
$node
)
{
$node
=
(
object
)
$node
;
if
(
!
isset
(
$node
->
name
))
{
//assign username to the node from $user created at auth step.
global
$user
;
$node
->
name
=
$user
->
name
;
}
if
(
!
isset
(
$node
->
type
))
{
return
services_error
(
'Missing node type'
,
406
);
}
...
...
services/node_service/node_resource.info
View file @
f110c123
; $Id$
name = Node Resource
description = Provides a resource oriented service interface to nodes.
package = Services - services
...
...
services/node_service/node_resource.models.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
...
...
services/node_service/node_resource.module
View file @
f110c123
<?php
// $Id$
/**
* @file
...
...
@@ -62,6 +61,13 @@ function node_resource_service_resource() {
'#callback'
=>
'_node_resource_update'
,
'#file'
=>
array
(
'file'
=>
'inc'
,
'module'
=>
'node_resource'
),
'#args'
=>
array
(
array
(
'#name'
=>
'nid'
,
'#optional'
=>
FALSE
,
'#source'
=>
array
(
'path'
=>
0
),
'#type'
=>
'int'
,
'#description'
=>
'The nid of the node to get'
,
),
array
(
'#name'
=>
'node'
,
'#optional'
=>
FALSE
,
...
...
services/node_service/node_service.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
...
...
@@ -55,7 +54,7 @@ function node_service_get($nid, $fields = array()) {
function
node_service_get_access
(
$nid
)
{
global
$user
;
$node
=
node_load
(
$nid
);
// If the node doesn't exist, we want to report a 'node not found' services
// error, but if we return FALSE here services will report an 'access denied'
// error. So we just return TRUE here and let everything move to fail in the
...
...
@@ -123,17 +122,21 @@ function node_service_save($edit) {
module_load_include
(
'inc'
,
'node'
,
'node.pages'
);
$nid
=
NULL
;
$edit
=
(
array
)
$edit
;
// The translation module relies on two $_GET variables in order to
// function properly. In order to properly save translated nodes, we will
// have to set these by hand when we detect this situation. Summarizing
// have to set these by hand when we detect this situation. Summarizing
// our feelings about having to implement this hack is left as an
// exercise for the reader.
if
(
!
empty
(
$edit
[
'tnid'
])
&&
!
empty
(
$edit
[
'language'
]))
{
$_GET
[
'language'
]
=
$edit
[
'language'
];
$_GET
[
'translation'
]
=
$edit
[
'tnid'
];
}
global
$language
;
$languages
=
language_list
();
$language
=
isset
(
$languages
[
$edit
[
'language'
]])
?
$languages
[
$edit
[
'language'
]]
:
$language
;
if
(
$edit
[
'nid'
])
{
$node
=
node_load
(
$edit
[
'nid'
]);
if
(
$node
->
nid
)
{
...
...
@@ -161,8 +164,8 @@ function node_service_save($edit) {
}
else
{
// If the submitted node has no author (for instance if it was
// created programmatically by hand) then set the currently logged
// in user as the author.
// created programmatically by hand) then set the currently logged
// in user as the author.
if
(
!
$edit
[
'uid'
])
{
global
$user
;
$edit
[
'uid'
]
=
$user
->
uid
;
...
...
@@ -178,14 +181,14 @@ function node_service_save($edit) {
// Fetch $nid out of $form_state
$nid
=
$form_state
[
'nid'
];
}
// Now unset those $_GET params so they're not hanging around causing trouble
// for anyone else.
if
(
isset
(
$_GET
[
'language'
]))
{
unset
(
$_GET
[
'language'
]);
unset
(
$_GET
[
'translation'
]);
}
if
(
$errors
=
form_get_errors
())
{
return
services_error
(
implode
(
"
\n
"
,
$errors
),
401
);
}
...
...
@@ -202,8 +205,10 @@ function node_service_save($edit) {
*/
function
node_service_save_access
(
$node
)
{
$node
=
(
array
)
$node
;
if
(
isset
(
$node
[
'nid'
]))
{
return
node_access
(
'update'
,
$node
);
if
(
isset
(
$node
[
'nid'
])
&&
!
empty
(
$node
[
'nid'
]))
{
// Grab the existing node information and use that for the access check.
$old_node
=
node_load
(
$node
[
'nid'
]);
return
node_access
(
'update'
,
$old_node
);
}
return
node_access
(
'create'
,
$node
[
'type'
]);
}
...
...
services/node_service/node_service.info
View file @
f110c123
; $Id$
name = Node Service
description = Provides a node service.
package = Services - services
...
...
services/node_service/node_service.module
View file @
f110c123
<?php
// $Id$
/**
* @file
* Link general node functionalities to services module.
...
...
@@ -77,7 +76,7 @@ function node_service_service() {
'#args'
=>
array
(
array
(
'#name'
=>
'node'
,
'#type'
=>
'
struct
'
,
'#type'
=>
'
array
'
,
'#description'
=>
t
(
'A node object. Upon creation, node object must include "type". Upon update, node object must include "nid" and "changed".'
))),
'#return'
=>
'struct'
,
'#help'
=>
t
(
'Save a node object into the database.'
)),
...
...
services/search_service/search_service.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
* Link general search functionalities to services module.
...
...
services/search_service/search_service.info
View file @
f110c123
; $Id$
name = Search Service
description = Provides a search service.
package = Services - services
...
...
services/search_service/search_service.module
View file @
f110c123
<?php
// $Id$
/**
* @file
* Link general search functionalities to services module.
...
...
services/search_service/search_service_admin.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
...
...
services/system_service/system_service.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
...
...
services/system_service/system_service.info
View file @
f110c123
; $Id$
name = System Service
description = Provides system services.
package = Services - services
...
...
services/system_service/system_service.module
View file @
f110c123
<?php
// $Id$
/**
* @file
* Link general system functionalities to services module.
...
...
services/taxonomy_service/taxonomy_service.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
* Link general taxonomy functionalities to services module.
...
...
services/taxonomy_service/taxonomy_service.info
View file @
f110c123
; $Id$
name = Taxonomy Service
description = Provides a taxonomy service.
package = Services - services
...
...
services/taxonomy_service/taxonomy_service.module
View file @
f110c123
<?php
// $Id$
/**
* @file
* Link general taxonomy functionalities to services module.
...
...
services/user_service/user_service.inc
View file @
f110c123
<?php
// $Id$
/**
* @file
...
...
@@ -95,7 +94,8 @@ function user_service_login($username, $password) {
if
(
$user
->
uid
)
{
// Regenerate the session ID to prevent against session fixation attacks.
sess_regenerate
();
module_invoke_all
(
'user'
,
'login'
,
NULL
,
$user
);
$array
=
array
();
user_module_invoke
(
'login'
,
$array
,
$user
);
$return
=
new
stdClass
();
$return
->
sessid
=
session_id
();
...
...
@@ -122,7 +122,8 @@ function user_service_logout() {
// Destroy the current session:
session_destroy
();
module_invoke_all
(
'user'
,
'logout'
,
NULL
,
$user
);
$array
=
array
();
user_module_invoke
(
'logout'
,
$array
,
$user
);
// Load the anonymous user
$user
=
drupal_anonymous_user
();
...
...
@@ -170,7 +171,22 @@ function user_service_save($account) {
'pass2'
=>
$account
[
'pass'
],
);
$form_state
[
'values'
][
'op'
]
=
t
(
'Create new account'
);
$ret
=
drupal_execute
(
'user_register'
,
$form_state
);
// reset to anonymous user
global
$user
;
$orig_user
=
$user
;
session_save_session
(
FALSE
);
$user
=
user_load
(
array
(
'uid'
=>
0
));
// execute the register form
drupal_execute
(
'user_register'
,
$form_state
);
// find and store the new user into the form_state
$form_state
[
'user'
]
=
user_load
(
array
(
'name'
=>
$form_state
[
'values'
][
'name'
]));
// revert back to the original user.
$user
=
$orig_user
;
session_save_session
(
TRUE
);
}
else
{
// If a profile category was passed in, use it. Otherwise default
...
...
Prev
1
2
3
Next