Index: includes/utf8.inc.php =================================================================== --- includes/utf8.inc.php (revision 870) +++ includes/utf8.inc.php (working copy) @@ -4,7 +4,8 @@ die('Do not access this file directly.'); } -require_once(BASEDIR . '/plugins/dokuwiki/inc/utf8.php'); +if (!function_exists('utf8_encodefn')) + require_once(BASEDIR . '/plugins/dokuwiki/inc/utf8.php'); // a-z A-Z . _ -, extended latin chars, Cyrillic and Greek $UTF8_ALPHA_CHARS = array( Index: includes/class.tpl.php =================================================================== --- includes/class.tpl.php (revision 870) +++ includes/class.tpl.php (working copy) @@ -633,35 +633,6 @@ return $html . ''; } // }}} -/** - * Highlights searchqueries in HTML code - * - * @author Andreas Gohr - * @author Harry Fuecks - */ -function html_hilight($html,$query){ - //split at common delimiters - $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>]+/',$query,-1,PREG_SPLIT_NO_EMPTY); - foreach ($queries as $q){ - $q = preg_quote($q,'/'); - $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html); - } - return $html; -} - -/** - * Callback used by html_hilight() - * - * @author Harry Fuecks - */ -function html_hilight_callback($m) { - $hlight = unslash($m[0]); - if ( !isset($m[2])) { - $hlight = ''.$hlight.''; - } - return $hlight; -} - function tpl_disableif ($if) { if ($if) { Index: plugins/dokuwiki/inc/html.php =================================================================== --- plugins/dokuwiki/inc/html.php (revision 870) +++ plugins/dokuwiki/inc/html.php (working copy) @@ -304,7 +304,36 @@ + * @author Harry Fuecks + */ +function html_hilight($html,$query){ + //split at common delimiters + $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>]+/',$query,-1,PREG_SPLIT_NO_EMPTY); + foreach ($queries as $q){ + $q = preg_quote($q,'/'); + $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html); + } + return $html; +} +/** + * Callback used by html_hilight() + * + * @author Harry Fuecks + */ +function html_hilight_callback($m) { + $hlight = unslash($m[0]); + if ( !isset($m[2])) { + $hlight = ''.$hlight.''; + } + return $hlight; +} + + /** * Run a search and display the result * Index: includes/constants.inc.php =================================================================== --- includes/constants.inc.php (revision 870) +++ includes/constants.inc.php (working copy) @@ -20,13 +20,14 @@ $baseurl = rtrim(Flyspray::absoluteURI($webdir),'/\\') . '/' ; } - +if (!defined('FS_NO_PLUGINS')) { $path_to_plugin = BASEDIR . '/plugins/' . trim($conf['general']['syntax_plugin']) . '/' . trim($conf['general']['syntax_plugin']) . '_constants.inc.php'; if (is_readable($path_to_plugin)) { include($path_to_plugin); } +} define('NOTIFY_TASK_OPENED', 1); define('NOTIFY_TASK_CHANGED', 2); @@ -61,4 +62,5 @@ //define('DEBUG_SQL',true); //define('JABBER_DEBUG', true); //define('JABBER_DEBUG_FILE''/path/to/my/debug/file'); + ?> Index: header.php =================================================================== --- header.php (revision 870) +++ header.php (working copy) @@ -21,7 +21,8 @@ require_once BASEDIR . '/includes/class.backend.php'; require_once BASEDIR . '/includes/class.project.php'; require_once BASEDIR . '/includes/class.user.php'; -require_once BASEDIR . '/includes/class.tpl.php'; +if (!defined('FS_NO_TPL')) + require_once BASEDIR . '/includes/class.tpl.php'; require_once BASEDIR . '/includes/i18n.inc.php'; $db = new Database; Index: includes/fix.inc.php =================================================================== --- includes/fix.inc.php (revision 870) +++ includes/fix.inc.php (working copy) @@ -11,7 +11,7 @@ // html errors will mess the layout ini_set('html_errors', 0); -error_reporting(E_ALL); +error_reporting(defined('FS_ERROR_REPORTING') ? FS_ERROR_REPORTING : E_ALL ); // our default charset Index: includes/class.flyspray.php =================================================================== --- includes/class.flyspray.php (revision 870) +++ includes/class.flyspray.php (working copy) @@ -647,6 +647,10 @@ // Set cookie {{{ /** * Sets a cookie, automatically setting the URL + * This behaves differently from native php setcookie: + * if $time is null, this function sets it to a month from now. + * If you want to have browser expiration, set $time to -1. + * If you want to delete a cookie, set $val to '' and $time to time() - 60. * @param string $name * @param string $val * @param integer $time @@ -656,12 +660,22 @@ */ function setCookie($name, $val, $time = null) { - global $baseurl; - $url = parse_url($baseurl); - if (is_null($time)) { + if (is_null($time)) { $time = time()+60*60*24*30; - } - return setcookie($name, $val, $time, str_replace('%2F', '/', rawurlencode($url['path']))); + } + else if ($time == -1) { + $time = NULL; + } + global $conf; + $path = $conf['general']['cookiepath']; + if (!$path) { + global $baseurl; + $url = parse_url($baseurl); + $path = str_replace('%2F', '/', rawurlencode($url['path'])); + } + $ok = setcookie($name, $val, $time, $path); + if (!$ok) trigger_error("setcookie failed: name=$name val=$val time=$time path=$path", E_USER_WARNING); + return $ok; } // }}} // Reminder daemon {{{ /** Index: scripts/authenticate.php =================================================================== --- scripts/authenticate.php (revision 870) +++ scripts/authenticate.php (working copy) @@ -32,14 +32,14 @@ if (Req::has('remember_login')) { $cookie_time = time() + (60 * 60 * 24 * 30); // Set cookies for 30 days } else { - $cookie_time = 0; // Set cookies to expire when session ends (browser closes) + $cookie_time = -1; // Set cookies to expire when session ends (browser closes) } $user = new User($user_id); // Set a couple of cookies - Flyspray::setcookie('flyspray_userid', $user->id, $cookie_time); - Flyspray::setcookie('flyspray_passhash', crypt($user->infos['user_pass'], $conf['general']['cookiesalt']), $cookie_time); + Flyspray::setCookie('flyspray_userid', $user->id, $cookie_time); + Flyspray::setCookie('flyspray_passhash', crypt($user->infos['user_pass'], $conf['general']['cookiesalt']), $cookie_time); // If the user had previously requested a password change, remove the magic url $remove_magic = $db->Query("UPDATE {users} SET magic_url = '' WHERE user_id = ?", Index: class.user.php =================================================================== --- class.user.php (revision 870) +++ class.user.php (working copy) @@ -13,16 +13,18 @@ function User($uid = 0) { global $db; - + $nrows = 0; if ($uid > 0) { $sql = $db->Query('SELECT *, g.group_id AS global_group, uig.record_id AS global_record_id FROM {users} u, {users_in_groups} uig, {groups} g WHERE u.user_id = ? AND uig.user_id = ? AND g.project_id = 0 AND uig.group_id = g.group_id', array($uid, $uid)); + $nrows = $db->countRows($sql); + // if (!$nrows) trigger_error("got no user row for uid $uid", E_USER_WARNING); } - if ($uid > 0 && $db->countRows($sql)) { + if ($uid > 0 && $nrows) { $this->infos = $db->FetchRow($sql); $this->id = intval($uid); } else { @@ -166,8 +168,8 @@ || !$this->infos['account_enabled'] || !$this->perms('group_open', 0)) { - Flyspray::setcookie('flyspray_userid', '', time()-60); - Flyspray::setcookie('flyspray_passhash', '', time()-60); + Flyspray::setCookie('flyspray_userid', '', time()-60); + Flyspray::setCookie('flyspray_passhash', '', time()-60); Flyspray::Redirect(CreateURL('logout', null)); } } @@ -294,16 +296,19 @@ function logout() { // Set cookie expiry time to the past, thus removing them - Flyspray::setcookie('flyspray_userid', '', time()-60); - Flyspray::setcookie('flyspray_passhash', '', time()-60); - Flyspray::setcookie('flyspray_project', '', time()-60); + Flyspray::setCookie('flyspray_userid', '', time()-60); + Flyspray::setCookie('flyspray_passhash', '', time()-60); + Flyspray::setCookie('flyspray_project', '', time()-60); if (Cookie::has(session_name())) { - Flyspray::setcookie(session_name(), '', time()-60); + Flyspray::setCookie(session_name(), '', time()-60); } // Unset all of the session variables. $_SESSION = array(); - session_destroy(); + + // don't destroy the DokuWiki session (in case of integration) + if (session_name() != 'DokuWiki') + session_destroy(); return !$this->isAnon(); }