diff --git a/admin.php b/admin.php
index 7966ee2..a70eb38 100644
--- a/admin.php
+++ b/admin.php
@@ -80,6 +80,12 @@ function handle() {
// reset the client
$this->client = null;
}
+
+ if($_REQUEST['delprofile']){
+ $this->_profileDel();
+ $this->profno = '';
+ $this->client = null;
+ }
}
/**
@@ -151,6 +157,7 @@ function html() {
echo $this->locale_xhtml('intro');
echo '
';
+
$this->_profilelist($this->profno);
if($this->profno !=='' ){
echo '
';
@@ -182,6 +189,13 @@ function _profileSave(){
$profiles = $conf['metadir'].'/sync.profiles';
io_saveFile($profiles,serialize($this->profiles));
}
+
+ function _profileDel(){
+ global $conf;
+ $profiles = $conf['metadir'].'/sync.profiles';
+ unset($this->profiles[$this->profno]);
+ io_saveFile($profiles,serialize($this->profiles));
+ }
/**
* Check connection for choosen profile and display last sync date.
@@ -220,20 +234,19 @@ function _profileView(){
function _profilelist($no=''){
echo '';
}
@@ -253,6 +266,9 @@ function _profileform($no=''){
echo '';
+ echo ' ';
+ echo '';
+
echo ' ';
echo '';
echo 'http://example.com/dokuwiki/lib/exe/xmlrpc.php';
@@ -603,59 +619,61 @@ function _getSyncList($type='pages'){
global $conf;
$no = $this->profno;
$list = array();
- $ns = $this->profiles[$no]['ns'];
+ $namespaces = explode(",",$this->profiles[$no]['ns']);
- // get remote file list
- if($type == 'pages'){
- $ok = $this->client->query('dokuwiki.getPagelist',$ns,
- array('depth' => (int) $this->profiles[$no]['depth'],
- 'hash' => true));
- }else{
- $ok = $this->client->query('wiki.getAttachments',$ns,
- array('depth' => (int) $this->profiles[$no]['depth'],
- 'hash' => true));
- }
- if(!$ok){
- msg('Failed to fetch remote file list. '.
- $this->client->getErrorMessage(),-1);
- return false;
- }
- $remote = $this->client->getResponse();
- // put into synclist
- foreach($remote as $item){
- $list[$item['id']]['remote'] = $item;
- unset($list[$item['id']]['remote']['id']);
- }
- unset($remote);
+ foreach($namespaces as $ns){
+ // get remote file list
+ if($type == 'pages'){
+ $ok = $this->client->query('dokuwiki.getPagelist',$ns,
+ array('depth' => (int) $this->profiles[$no]['depth'],
+ 'hash' => true));
+ }else{
+ $ok = $this->client->query('wiki.getAttachments',$ns,
+ array('depth' => (int) $this->profiles[$no]['depth'],
+ 'hash' => true));
+ }
+ if(!$ok){
+ msg('Failed to fetch remote file list. '.
+ $this->client->getErrorMessage(),-1);
+ return false;
+ }
+ $remote = $this->client->getResponse();
+ // put into synclist
+ foreach($remote as $item){
+ $list[$item['id']]['remote'] = $item;
+ unset($list[$item['id']]['remote']['id']);
+ }
+ unset($remote);
- // get local file list
- $local = array();
- $dir = utf8_encodeFN(str_replace(':', '/', $ns));
- require_once(DOKU_INC.'inc/search.php');
- if($type == 'pages'){
- search($local, $conf['datadir'], 'search_allpages',
- array('depth' => (int) $this->profiles[$no]['depth'],
- 'hash' => true), $dir);
- }else{
- search($local, $conf['mediadir'], 'search_media',
- array('depth' => (int) $this->profiles[$no]['depth'],
- 'hash' => true), $dir);
- }
+ // get local file list
+ $local = array();
+ $dir = utf8_encodeFN(str_replace(':', '/', $ns));
+ require_once(DOKU_INC.'inc/search.php');
+ if($type == 'pages'){
+ search($local, $conf['datadir'], 'search_allpages',
+ array('depth' => (int) $this->profiles[$no]['depth'],
+ 'hash' => true), $dir);
+ }else{
+ search($local, $conf['mediadir'], 'search_media',
+ array('depth' => (int) $this->profiles[$no]['depth'],
+ 'hash' => true), $dir);
+ }
- // put into synclist
- foreach($local as $item){
- // skip identical files
- if($list[$item['id']]['remote']['hash'] == $item['hash']){
- unset($list[$item['id']]);
- continue;
+ // put into synclist
+ foreach($local as $item){
+ // skip identical files
+ if($list[$item['id']]['remote']['hash'] == $item['hash']){
+ unset($list[$item['id']]);
+ continue;
+ }
+
+ $list[$item['id']]['local'] = $item;
+ unset($list[$item['id']]['local']['id']);
}
+ unset($local);
- $list[$item['id']]['local'] = $item;
- unset($list[$item['id']]['local']['id']);
+ ksort($list);
}
- unset($local);
-
- ksort($list);
return $list;
}
@@ -688,4 +706,4 @@ function _diff($id){
echo '';
}
}
-//Setup VIM: ex: et ts=4 enc=utf-8 :
+//Setup VIM: ex: et ts=4 :
diff --git a/lang/en/lang.php b/lang/en/lang.php
index 2fdc462..6e813a5 100644
--- a/lang/en/lang.php
+++ b/lang/en/lang.php
@@ -14,9 +14,11 @@
$lang['profile'] = 'Sync Profile';
$lang['newprofile'] = 'New Profile...';
$lang['select'] = 'Select';
+$lang['delete'] = 'Delete';
$lang['create'] = 'Create new Sync Profile';
$lang['edit'] = 'Edit Sync Profile';
+$lang['name'] = 'Profile Name';
$lang['server'] = 'XMLRPC URL';
$lang['user'] = 'Username';
$lang['pass'] = 'Password';
diff --git a/lang/es/intro.txt b/lang/es/intro.txt
new file mode 100644
index 0000000..79e3127
--- /dev/null
+++ b/lang/es/intro.txt
@@ -0,0 +1,4 @@
+====== Sincronización de la Wiki ======
+
+Esta herramienta le permite sincronizar el contenido de su wiki con otras wikis. Múltiples wikis pueden ser configuradas usando perfiles de sincronización. La Sincronización puede ser restringida a ciertos namespaces.
+
diff --git a/lang/es/lang.php b/lang/es/lang.php
new file mode 100644
index 0000000..eb7eefc
--- /dev/null
+++ b/lang/es/lang.php
@@ -0,0 +1,60 @@
+