Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

edit.php
Go to the documentation of this file.
1 <?php
12 $session = ezcPersistentSessionInstance::get();
13
14 $module = $Params['Module'];
15
16 // @todo Instanciate the session maybe ?
17 $applicationId = $Params['ApplicationID'];
18 $application = $session->load( 'ezpRestClient', $applicationId );
19
20 // save the modified application
21 eZDebug::writeDebug( $module->currentAction() );
22 eZDebug::writeDebug( $_POST );
23
24 if ( $module->isCurrentAction( 'Store') )
25 {
26 $application->name = $module->actionParameter( 'Name' );
27
28 // generate id & secret
29 if ( $application->version == ezpRestClient::STATUS_DRAFT )
30 {
31 $application->client_id = md5( $application->name . uniqid( $application->name ) );
32 $application->client_secret = md5( $application->name . uniqid( $application->name ) );
33 }
34 $application->description = $module->actionParameter( 'Description' );
35 $application->endpoint_uri = $module->actionParameter( 'EndPointURI' );
36 $application->version = ezpRestClient::STATUS_PUBLISHED;
37 $application->modified = time();
38 $session->update( $application );
39
40 return $module->redirectTo( $module->functionURI( 'list' ) );
41 }
42
43 if ( $module->isCurrentAction( 'Discard' ) )
44 {
45 // if there is a draft, ditch it
46 if ( $application->version == ezpRestClient::STATUS_DRAFT )
47 $session->delete( $application);
48 return $module->redirectTo( $module->functionURI( 'list' ) );
49 }
50
51 $tpl = eZTemplate::factory();
52 $tpl->setVariable( 'module', $module );
53 $tpl->setVariable( 'application', $application );
54 $Result['path'] = array( array( 'url' => false,
55 'text' => ezpI18n::tr( 'kernel/oauthadmin', 'oAuth admin' ) ),
56 array( 'url' => false,
57 'text' => ezpI18n::tr( 'kernel/oauthadmin', 'Edit REST application' ) )
58 );
59
60 $Result['content'] = $tpl->fetch( 'design:oauthadmin/edit.tpl' );
61 return $Result;
62 ?>
eZDebug\writeDebug
static writeDebug( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:589
ezpRestClient\STATUS_PUBLISHED
const STATUS_PUBLISHED
Definition: restclient.php:269
ezpRestClient\STATUS_DRAFT
const STATUS_DRAFT
Definition: restclient.php:268
$application
$application
Definition: edit.php:18
$applicationId
$applicationId
Definition: edit.php:17
$session
$session
Definition: edit.php:12
$module
$module
Definition: edit.php:14
$tpl
if( $module->isCurrentAction( 'Store')) if( $module->isCurrentAction( 'Discard')) $tpl
Definition: edit.php:51
$Result
$Result['path']
Definition: edit.php:54
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.