Skip to content

Commit

Permalink
allow to publish remote control api from admin settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mennodekker committed Mar 19, 2013
1 parent e67dada commit 7bcd024
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions application/controllers/admin/globalsettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ private function _saveSettings()
setGlobalSetting('force_ssl', $_POST['force_ssl']);
setGlobalSetting('surveyPreview_require_Auth', $_POST['surveyPreview_require_Auth']);
setGlobalSetting('RPCInterface', $_POST['RPCInterface']);
setGlobalSetting('rpc_publish_api', (bool) $_POST['rpc_publish_api']);
$savetime = ((float)$_POST['timeadjust'])*60 . ' minutes'; //makes sure it is a number, at least 0
if ((substr($savetime, 0, 1) != '-') && (substr($savetime, 0, 1) != '+')) {
$savetime = '+' . $savetime;
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/remotecontrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function run()
exit;
} else {
// Disabled output of API methods for now
if (1 == 2 && in_array($RPCType, array('xml', 'json'))) {
if (Yii::app()->getConfig("rpc_publish_api") == true && in_array($RPCType, array('xml', 'json'))) {
$reflector = new ReflectionObject($oHandler);
foreach ($reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
/* @var $method ReflectionMethod */
Expand Down
11 changes: 11 additions & 0 deletions application/views/admin/globalSettings_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,17 @@
><?php $clang->eT("XML-RPC"); ?></option>
</select></li>
<li><label><?php $clang->eT("URL:"); ?></label><?php echo $this->createAbsoluteUrl("admin/remotecontrol"); ?></li>
<?php $rpc_publish_api=getGlobalSetting('rpc_publish_api'); ?>
<li><label for='rpc_publish_api'><?php $clang->eT("Publish API on /admin/remotecontrol:"); ?></label>
<select id='rpc_publish_api' name='rpc_publish_api'>
<option value='1'
<?php if ($rpc_publish_api == true) { echo " selected='selected'";}?>
><?php $clang->eT("Yes"); ?></option>
<option value='0'
<?php if ($rpc_publish_api == false) { echo " selected='selected'";}?>
><?php $clang->eT("No"); ?></option>
</select>
</li>
</ul>
</div>
<input type='hidden' name='restrictToLanguages' id='restrictToLanguages' value='<?php implode(' ',$restrictToLanguages); ?>'/>
Expand Down

0 comments on commit 7bcd024

Please sign in to comment.