From 148d2616e554964b59c5acaebf76333e5ae7f5eb Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Mon, 21 Oct 2013 21:29:45 +0200 Subject: introduce link_to_docs() and migrate links --- lib/base.php | 2 +- lib/private/config.php | 2 +- lib/private/setup.php | 2 +- lib/private/template/functions.php | 5 +++++ lib/private/util.php | 16 ++++++++-------- 5 files changed, 16 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/base.php b/lib/base.php index ee925b8f736..ef574b2d895 100644 --- a/lib/base.php +++ b/lib/base.php @@ -181,7 +181,7 @@ class OC { OC_Template::printErrorPage( "Can't write into config directory!", 'This can usually be fixed by ' - .'giving the webserver write access to the config directory.' + .'giving the webserver write access to the config directory.' ); } } diff --git a/lib/private/config.php b/lib/private/config.php index 72423137fa3..c28669f56a3 100644 --- a/lib/private/config.php +++ b/lib/private/config.php @@ -172,7 +172,7 @@ class Config { $result = @file_put_contents($this->configFilename, $content); if (!$result) { $defaults = new \OC_Defaults; - $url = $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions'; + $url = link_to_docs('admin-dir-permissions'); throw new HintException( "Can't write into config directory!", 'This can usually be fixed by ' diff --git a/lib/private/setup.php b/lib/private/setup.php index 6bf3c88370f..3cc1d29c6a4 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -183,7 +183,7 @@ class OC_Setup { $error = $l->t('Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken.'); $hint = $l->t('Please double check the installation guides.', - 'http://doc.owncloud.org/server/5.0/admin_manual/installation.html'); + link_to_docs('admin-install')); OC_Template::printErrorPage($error, $hint); exit(); diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php index 0aa2b27b96b..94b87d1e507 100644 --- a/lib/private/template/functions.php +++ b/lib/private/template/functions.php @@ -35,6 +35,11 @@ function link_to( $app, $file, $args = array() ) { return OC_Helper::linkTo( $app, $file, $args ); } +function link_to_docs($key) { + $theme = new OC_Defaults(); + return $theme->getDocBaseUrl() . '/server/5.0/go.php?to=' . $key; +} + /** * @brief make OC_Helper::imagePath available as a simple function * @param string $app app diff --git a/lib/private/util.php b/lib/private/util.php index 885cce87541..04b27ee61ae 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -303,16 +303,16 @@ class OC_Util { //common hint for all file permissions error messages $permissionsHint = 'Permissions can usually be fixed by ' - .'giving the webserver write access to the root directory.'; + .'giving the webserver write access to the root directory.'; // Check if config folder is writable. if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) { $errors[] = array( 'error' => "Can't write into config directory", 'hint' => 'This can usually be fixed by ' - .'giving the webserver write access to the config directory.' + .'giving the webserver write access to the config directory.' ); } @@ -324,8 +324,8 @@ class OC_Util { $errors[] = array( 'error' => "Can't write into apps directory", 'hint' => 'This can usually be fixed by ' - .'giving the webserver write access to the apps directory ' + .'giving the webserver write access to the apps directory ' .'or disabling the appstore in the config file.' ); } @@ -340,8 +340,8 @@ class OC_Util { $errors[] = array( 'error' => "Can't create data directory (".$CONFIG_DATADIRECTORY.")", 'hint' => 'This can usually be fixed by ' - .'giving the webserver write access to the root directory.' + .'giving the webserver write access to the root directory.' ); } } else if(!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { -- cgit v1.2.3 From 124984905e162160fe38d141d238c6102f549e9b Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Mon, 21 Oct 2013 22:01:27 +0200 Subject: introduce OC_Helper::linkToDocs() --- lib/private/helper.php | 9 +++++++++ lib/private/template/functions.php | 7 +++++-- lib/private/util.php | 8 ++++---- 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/private/helper.php b/lib/private/helper.php index e9b129db0ca..fca08adca8b 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -58,6 +58,15 @@ class OC_Helper { return OC::$server->getURLGenerator()->linkTo($app, $file, $args); } + /** + * @param $key + * @return string url to the online documentation + */ + public static function linkToDocs($key) { + $theme = new OC_Defaults(); + return $theme->getDocBaseUrl() . '/server/5.0/go.php?to=' . $key; + } + /** * @brief Creates an absolute url * @param string $app app diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php index 94b87d1e507..ce42633b364 100644 --- a/lib/private/template/functions.php +++ b/lib/private/template/functions.php @@ -35,9 +35,12 @@ function link_to( $app, $file, $args = array() ) { return OC_Helper::linkTo( $app, $file, $args ); } +/** + * @param $key + * @return string url to the online documentation + */ function link_to_docs($key) { - $theme = new OC_Defaults(); - return $theme->getDocBaseUrl() . '/server/5.0/go.php?to=' . $key; + return OC_Helper::linkToDocs($key); } /** diff --git a/lib/private/util.php b/lib/private/util.php index 04b27ee61ae..f63884c0f32 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -303,7 +303,7 @@ class OC_Util { //common hint for all file permissions error messages $permissionsHint = 'Permissions can usually be fixed by ' - .'giving the webserver write access to the root directory.'; // Check if config folder is writable. @@ -311,7 +311,7 @@ class OC_Util { $errors[] = array( 'error' => "Can't write into config directory", 'hint' => 'This can usually be fixed by ' - .'giving the webserver write access to the config directory.' ); } @@ -324,7 +324,7 @@ class OC_Util { $errors[] = array( 'error' => "Can't write into apps directory", 'hint' => 'This can usually be fixed by ' - .'giving the webserver write access to the apps directory ' .'or disabling the appstore in the config file.' ); @@ -340,7 +340,7 @@ class OC_Util { $errors[] = array( 'error' => "Can't create data directory (".$CONFIG_DATADIRECTORY.")", 'hint' => 'This can usually be fixed by ' - .'giving the webserver write access to the root directory.' ); } -- cgit v1.2.3 From 87a09156f8f6b95119b35a5c7bdaafdcd263aa80 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Mon, 21 Oct 2013 23:08:09 +0200 Subject: use OC_Helper::linkToDocs() in lib/private/config.php --- lib/private/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/config.php b/lib/private/config.php index c28669f56a3..caf7b1d7066 100644 --- a/lib/private/config.php +++ b/lib/private/config.php @@ -172,7 +172,7 @@ class Config { $result = @file_put_contents($this->configFilename, $content); if (!$result) { $defaults = new \OC_Defaults; - $url = link_to_docs('admin-dir-permissions'); + $url = \OC_Helper::linkToDocs('admin-dir-permissions'); throw new HintException( "Can't write into config directory!", 'This can usually be fixed by ' -- cgit v1.2.3