diff --git a/lib/authentication/builtinauthenticationprovider.inc.php b/lib/authentication/builtinauthenticationprovider.inc.php index 59a30b4..c9116c4 100644 --- a/lib/authentication/builtinauthenticationprovider.inc.php +++ b/lib/authentication/builtinauthenticationprovider.inc.php @@ -15,7 +15,9 @@ class KTBuiltinAuthenticationProvider extends KTAuthenticationProvider { } function showUserSource($oUser, $oSource) { - return '
' . sprintf(_("Change %s's password"), $oUser->getName()) . '
'; + $sQuery = sprintf('action=setPassword&user_id=%d', $oUser->getId()); + $sUrl = KTUtil::addQueryString($_SERVER['PHP_SELF'], $sQuery); + return '' . sprintf(_("Change %s's password"), $oUser->getName()) . '
'; } } diff --git a/lib/dispatcher.inc.php b/lib/dispatcher.inc.php index 85b895a..13ed0af 100644 --- a/lib/dispatcher.inc.php +++ b/lib/dispatcher.inc.php @@ -87,15 +87,16 @@ class KTDispatcher { foreach ($sQuery as $k => $v) { $aQueryStrings[] = urlencode($k) . "=" . urlencode($v); } - $sQuery = "?" . join('&', $aQueryStrings); + $sQuery = join('&', $aQueryStrings); } else { if (!empty($sQuery)) { - $sQuery = '?action=' . $event . '&' . $sQuery; + $sQuery = 'action=' . $event . '&' . $sQuery; } else { - $sQuery = '?action=' . $event; + $sQuery = 'action=' . $event; } } - $this->oRedirector->redirect($_SERVER["PHP_SELF"] . $sQuery); + $sRedirect = KTUtil::addQueryString($_SERVER['PHP_SELF'], $sQuery); + $this->oRedirector->redirect($sRedirect); exit(0); } diff --git a/lib/session/control.inc b/lib/session/control.inc index bf42e8b..134cdf3 100644 --- a/lib/session/control.inc +++ b/lib/session/control.inc @@ -61,40 +61,17 @@ function controllerRedirect($sAction, $sQueryString = "") { function generateLink($sTargetPage, $sQueryString = "", $sLinkText = "") { global $default; - $sQueryStringDelimiter = strlen($sQueryString) > 0 ? (strstr($sTargetPage, "?") ? "&" : "?") : ""; - $sLink = "http" . ($default->sslEnabled ? "s" : "") . "://" . $default->serverName . ((substr($sTargetPage, 0, strlen($default->rootUrl)) != $default->rootUrl) ? $default->rootUrl : "") . (substr($sTargetPage, 0, 1) == "/" ? "" : "/") . - $sTargetPage . $sQueryStringDelimiter . $sQueryString; + $sTargetPage; + + $sLink = KTUtil::addQueryString($sLink, $sQueryString); return (strlen($sLinkText) > 0) ? "$sLinkText" : $sLink; } /** - * Generates a link used when setting up template documents for document linking in folder - * collaboration. Formatted to send document name and id back to parent window - * - * @param string the url to link to - * @param string the querystring - * @param string the link text (optional) - * @return string the html link if the link text is specified, otherwise just the url - */ -function generateLinkForTemplateDocumentBrowse($sTargetPage, $sQueryString, $sLinkText = "", $sDocumentName, $iDocumentID) { - global $default; - - if (strlen($sQueryString) > 0) { - $sQueryStringDelimiter = (strstr($sTargetPage, "?") ? "&" : "?"); - } - $sLink = "http" . ($default->sslEnabled ? "s" : "") . "://" . $default->serverName . - ((substr($sTargetPage, 0, strlen($default->rootUrl)) != $default->rootUrl) ? $default->rootUrl : "") . - $sTargetPage . $sQueryStringDelimiter . $sQueryString; - - return (strlen($sLinkText) > 0) ? "$sLinkText" : $sLink; -} - - -/** * Returns a controller url. * * @param string the controller action to generate a url for diff --git a/lib/templating/smartytemplate.inc.php b/lib/templating/smartytemplate.inc.php index 0b04774..f1cd59e 100644 --- a/lib/templating/smartytemplate.inc.php +++ b/lib/templating/smartytemplate.inc.php @@ -76,6 +76,7 @@ class KTSmartyTemplate extends KTTemplate { $smarty->register_function('entity_checkboxes', array('KTSmartyTemplate', 'entity_checkboxes')); $smarty->register_function('entity_radios', array('KTSmartyTemplate', 'entity_radios')); $smarty->register_block('i18n', array('KTSmartyTemplate', 'i18n_block'), false); + $smarty->register_modifier('addQueryString', array('KTSmartyTemplate', 'addQueryString')); return $smarty->fetch($this->sPath); } @@ -223,6 +224,10 @@ class KTSmartyTemplate extends KTTemplate { return smarty_function_html_radios($params, $smarty); } + + function addQueryString($url, $qs) { + return KTUtil::addQueryString($url, $qs); + } } ?> diff --git a/templates/ktcore/document/add.smarty b/templates/ktcore/document/add.smarty index 7bbb467..574f9de 100644 --- a/templates/ktcore/document/add.smarty +++ b/templates/ktcore/document/add.smarty @@ -57,7 +57,7 @@ addLoadEvent(startupMetadata);