Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class admin_plugin_sync extends DokuWiki_Admin_Plugin {
protected $profno = '';
protected $client = null;
protected $apiversion = 0;
protected $defaultTimeout = 15;

/**
* Constructor.
Expand All @@ -28,6 +29,12 @@ function admin_plugin_sync(){
function _connect(){
if(!is_null($this->client)) return true;
$this->client = new IXR_Client($this->profiles[$this->profno]['server']);
if ( isset($this->profiles[$this->profno]['timeout']) ){
$timeout = (int) $this->profiles[$this->profno]['timeout'];
} else {
$timeout = $this->defaultTimeout;
}
$this->client->timeout = $timeout;

// do the login
if($this->profiles[$this->profno]['user']){
Expand Down Expand Up @@ -83,6 +90,9 @@ function handle() {
}else{
// add/edit profile
if($this->profno === '') $this->profno = count($this->profiles);
if ( !isset($_REQUEST['prf']['timeout']) || !is_numeric($_REQUEST['prf']['timeout']) ){
$_REQUEST['prf']['timeout'] = $this->defaultTimeout;
}
$this->profiles[$this->profno] = $_REQUEST['prf'];
}
$this->_profileSave();
Expand Down Expand Up @@ -285,6 +295,9 @@ function _profileform($no=''){
echo '<label for="sync__pass">'.$this->getLang('pass').'</label> ';
echo '<input type="password" name="prf[pass]" id="sync__pass" class="edit" value="'.hsc($this->profiles[$no]['pass']).'" />';

echo '<label for="sync__timeout">'.$this->getLang('timeout').'</label>';
echo '<input type="number" name="prf[timeout]" id="sync__timeout" class="edit" value="'.hsc($this->profiles[$no]['timeout']).'" />';

echo '<span>'.$this->getLang('type').'</span>';

echo '<div class="type">';
Expand All @@ -298,6 +311,7 @@ function _profileform($no=''){
echo '<label for="sync__type2">'.$this->getLang('type2').'</label> ';
echo '</div>';


echo '<div class="submit">';
echo '<input type="submit" value="'.$this->getLang('save').'" class="button" />';
if($no !== '' && $this->profiles[$no]['ltime']){
Expand Down
1 change: 1 addition & 0 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@
$lang['keep'] = 'Skip this file and keep both revisions as is.';

$lang['syncdone'] = 'Synchronization finished.';
$lang['timeout'] = 'Timeout';