diff options
Diffstat (limited to 'lib/exe')
-rw-r--r-- | lib/exe/ajax.php | 2 | ||||
-rw-r--r-- | lib/exe/css.php | 63 | ||||
-rw-r--r-- | lib/exe/indexer.php | 44 | ||||
-rw-r--r-- | lib/exe/mediamanager.php | 2 | ||||
-rw-r--r-- | lib/exe/xmlrpc.php | 29 |
5 files changed, 37 insertions, 103 deletions
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 1939a7bcb..7d594dc04 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -238,7 +238,7 @@ function ajax_linkwiz(){ global $conf; global $lang; - $q = ltrim($_POST['q'],':'); + $q = ltrim(trim($_POST['q']),':'); $id = noNS($q); $ns = getNS($q); diff --git a/lib/exe/css.php b/lib/exe/css.php index 4db81de0b..03f900034 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -30,10 +30,10 @@ function css_out(){ global $lang; global $config_cascade; - $style = ''; + $mediatype = 'screen'; if (isset($_REQUEST['s']) && in_array($_REQUEST['s'], array('all', 'print', 'feed'))) { - $style = $_REQUEST['s']; + $mediatype = $_REQUEST['s']; } $tpl = trim(preg_replace('/[^\w-]+/','',$_REQUEST['t'])); @@ -46,7 +46,7 @@ function css_out(){ } // The generated script depends on some dynamic options - $cache = getCacheName('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$style,'.css'); + $cache = getCacheName('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$mediatype,'.css'); // load template styles $tplstyles = array(); @@ -60,27 +60,29 @@ function css_out(){ // Array of needed files and their web locations, the latter ones // are needed to fix relative paths in the stylesheets $files = array(); - //if (isset($tplstyles['all'])) $files = array_merge($files, $tplstyles['all']); - if(!empty($style)){ - $files[DOKU_INC.'lib/styles/'.$style.'.css'] = DOKU_BASE.'lib/styles/'; - // load plugin, template, user styles - $files = array_merge($files, css_pluginstyles($style)); - if (isset($tplstyles[$style])) $files = array_merge($files, $tplstyles[$style]); - - if(isset($config_cascade['userstyle'][$style])){ - $files[$config_cascade['userstyle'][$style]] = DOKU_BASE; - } - }else{ - $files[DOKU_INC.'lib/styles/style.css'] = DOKU_BASE.'lib/styles/'; - // load plugin, template, user styles - $files = array_merge($files, css_pluginstyles('screen')); - if (isset($tplstyles['screen'])) $files = array_merge($files, $tplstyles['screen']); + // load core styles + $files[DOKU_INC.'lib/styles/'.$mediatype.'.css'] = DOKU_BASE.'lib/styles/'; + // load plugin styles + $files = array_merge($files, css_pluginstyles($mediatype)); + // load template styles + if (isset($tplstyles[$mediatype])) { + $files = array_merge($files, $tplstyles[$mediatype]); + } + // if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility + if (isset($config_cascade['userstyle']['default'])) { + $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default']; + } + // load user styles + if(isset($config_cascade['userstyle'][$mediatype])){ + $files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; + } + // load rtl styles + // @todo: this currently adds the rtl styles only to the 'screen' media type + // but 'print' and 'all' should also be supported + if ($mediatype=='screen') { if($lang['direction'] == 'rtl'){ if (isset($tplstyles['rtl'])) $files = array_merge($files, $tplstyles['rtl']); } - if(isset($config_cascade['userstyle']['default'])){ - $files[$config_cascade['userstyle']['default']] = DOKU_BASE; - } } // check cache age & handle conditional request @@ -122,7 +124,7 @@ function css_out(){ // apply style replacements $css = css_applystyle($css,$tplinc); - + // place all @import statements at the top of the file $css = css_moveimports($css); @@ -202,7 +204,7 @@ function css_interwiki(){ // default style echo 'a.interwiki {'; echo ' background: transparent url('.DOKU_BASE.'lib/images/interwiki.png) 0px 1px no-repeat;'; - echo ' padding-left: 16px;'; + echo ' padding: 1px 0px 1px 16px;'; echo '}'; // additional styles when icon available @@ -278,20 +280,15 @@ function css_loadfile($file,$location=''){ * * @author Andreas Gohr <andi@splitbrain.org> */ -function css_pluginstyles($mode='screen'){ +function css_pluginstyles($mediatype='screen'){ global $lang; $list = array(); $plugins = plugin_list(); foreach ($plugins as $p){ - if($mode == 'all'){ - $list[DOKU_PLUGIN."$p/all.css"] = DOKU_BASE."lib/plugins/$p/"; - }elseif($mode == 'print'){ - $list[DOKU_PLUGIN."$p/print.css"] = DOKU_BASE."lib/plugins/$p/"; - }elseif($mode == 'feed'){ - $list[DOKU_PLUGIN."$p/feed.css"] = DOKU_BASE."lib/plugins/$p/"; - }else{ + $list[DOKU_PLUGIN."$p/$mediatype.css"] = DOKU_BASE."lib/plugins/$p/"; + // alternative for screen.css + if ($mediatype=='screen') { $list[DOKU_PLUGIN."$p/style.css"] = DOKU_BASE."lib/plugins/$p/"; - $list[DOKU_PLUGIN."$p/screen.css"] = DOKU_BASE."lib/plugins/$p/"; } if($lang['direction'] == 'rtl'){ $list[DOKU_PLUGIN."$p/rtl.css"] = DOKU_BASE."lib/plugins/$p/"; @@ -302,7 +299,7 @@ function css_pluginstyles($mode='screen'){ /** * Move all @import statements in a combined stylesheet to the top so they - * aren't ignored by the browser. + * aren't ignored by the browser. * * @author Gabriel Birke <birke@d-scribe.de> */ diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 0042e92d2..95e2af05b 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -11,9 +11,6 @@ require_once(DOKU_INC.'inc/init.php'); session_write_close(); //close session if(!defined('NL')) define('NL',"\n"); -// Version tag used to force rebuild on upgrade -define('INDEXER_VERSION', 3); - // keep running after browser closes connection @ignore_user_abort(true); @@ -136,47 +133,8 @@ function runIndexer(){ if(!$ID) return false; - // check if indexing needed - $idxtag = metaFN($ID,'.indexed'); - if(@file_exists($idxtag)){ - if(io_readFile($idxtag) >= INDEXER_VERSION){ - $last = @filemtime($idxtag); - if($last > @filemtime(wikiFN($ID))){ - print "runIndexer(): index for $ID up to date".NL; - return false; - } - } - } - - // try to aquire a lock - $run = 0; - $lock = $conf['lockdir'].'/_indexer.lock'; - while(!@mkdir($lock,$conf['dmode'])){ - usleep(50); - if(is_dir($lock) && time()-@filemtime($lock) > 60*5){ - // looks like a stale lock - remove it - if (!@rmdir($lock)) { - print "runIndexer(): removing the stale lock failed".NL; - return false; - } else { - print "runIndexer(): stale lock removed".NL; - } - }elseif($run++ == 1000){ - // we waited 5 seconds for that lock - print "runIndexer(): indexer locked".NL; - return false; - } - } - if($conf['dperm']) chmod($lock, $conf['dperm']); - // do the work - idx_addPage($ID); - - // we're finished - save and free lock - io_saveFile(metaFN($ID,'.indexed'),INDEXER_VERSION); - @rmdir($lock); - print "runIndexer(): finished".NL; - return true; + return idx_addPage($ID, true); } /** diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php index 6f2add2be..02fde5a8d 100644 --- a/lib/exe/mediamanager.php +++ b/lib/exe/mediamanager.php @@ -91,7 +91,7 @@ if ($res & DOKU_MEDIA_EMPTY_NS) { // current namespace was removed. redirecting to root ns passing msg along send_redirect(DOKU_URL.'lib/exe/mediamanager.php?msg1='. - rawurlencode($msg)); + rawurlencode($msg).'&edid='.$_REQUEST['edid']); } msg($msg,1); } elseif ($res & DOKU_MEDIA_INUSE) { diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index 9749a2e16..108dd8fd1 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -1,7 +1,7 @@ <?php if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); -// fix when '<?xml' isn't on the very first line +// fix when '< ?xml' isn't on the very first line if(isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); /** @@ -364,9 +364,8 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { */ function listPages(){ $list = array(); - $pages = array_filter(array_filter(idx_getIndex('page', ''), - 'isVisiblePage'), - 'page_exists'); + $pages = idx_get_indexer()->getPages(); + $pages = array_filter(array_filter($pages,'isVisiblePage'),'page_exists'); foreach(array_keys($pages) as $idx) { $perm = auth_quickaclcheck($pages[$idx]); @@ -562,27 +561,7 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { unlock($id); // run the indexer if page wasn't indexed yet - if(!@file_exists(metaFN($id, '.indexed'))) { - // try to aquire a lock - $lock = $conf['lockdir'].'/_indexer.lock'; - while(!@mkdir($lock,$conf['dmode'])){ - usleep(50); - if(time()-@filemtime($lock) > 60*5){ - // looks like a stale lock - remove it - @rmdir($lock); - }else{ - return false; - } - } - if($conf['dperm']) chmod($lock, $conf['dperm']); - - // do the work - idx_addPage($id); - - // we're finished - save and free lock - io_saveFile(metaFN($id,'.indexed'),INDEXER_VERSION); - @rmdir($lock); - } + idx_addPage($id); return 0; } |