fshlp =& plugin_load('helper', 'freesync'); if(!$this->fshlp) msg('Loading the freesync helper failed. Make sure that the tags plugin is installed.', -1); } /** * return some info */ function getInfo(){ return array( 'author' => 'Mikhail I. Izmestev', 'email' => 'izmmishao5@gmail.com', 'date' => '2009-03-09', 'name' => 'freesync dokuwiki plugin', 'desc' => 'Free sync plugin', 'url' => '', ); } /** * return sort order for position in admin menu */ function getMenuSort() { return 999; } /** * handle user request */ function handle() { $fn = $_REQUEST['fn']; if (is_array($fn)) { $cmd = key($fn); $param = is_array($fn[$cmd]) ? $fn[$cmd] : null; } else { $cmd = $fn; $param = null; } $this->fshlp->loadProfile($_REQUEST['profile']); switch($cmd) { case "save_profile": $this->fshlp->saveProfile($_REQUEST['oldname'], $param); break; case "sync": $this->_sync(); break; case "dosync": $this->_dosync($_REQUEST['pages'], $_REQUEST['files'], $_REQUEST['sum']); break; } } function _dosync($pages, $files, $summary) { $this->_sum = $summary; $this->_showDoSync = 1; function needmerge($var) { return $var != 'nothing'; } if(!is_array($pages)) $pages = array(); if(!is_array($files)) $files = array(); $this->_sync_list_pages = array_filter($pages, "needmerge"); $this->_sync_list_files = array_filter($files, "needmerge"); } function _sync() { $this->_sync_list = $this->fshlp->getPagesDiff(); if(empty($this->_sync_list)) msg("All pages are synchronized"); else $this->_showSync = 1; } function _html_profileSelect() { ptln('