diff options
-rw-r--r-- | core/css/styles.css | 2 | ||||
-rw-r--r-- | core/lostpassword/templates/lostpassword.php | 31 | ||||
-rwxr-xr-x | lib/request.php | 13 | ||||
-rw-r--r-- | lib/templatelayout.php | 59 | ||||
-rw-r--r-- | lib/user.php | 2 |
5 files changed, 46 insertions, 61 deletions
diff --git a/core/css/styles.css b/core/css/styles.css index 4dfa3f64a37..6eea2be433d 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -220,6 +220,8 @@ label.infield { cursor:text !important; top:1.05em; left:.85em; } } #login #databaseField .infield { padding-left:0; } #login form input[type="checkbox"]+label { position:relative; margin:0; font-size:1em; text-shadow:#fff 0 1px 0; } +#login form .errors { background:#fed7d7; border:1px solid #f00; list-style-indent:inside; margin:0 0 2em; padding:1em; } +#login .success { background:#d7fed7; border:1px solid #0f0; width: 35%; margin: 30px auto; padding:1em; text-align: center;} /* Show password toggle */ #show, #dbpassword { position:absolute; right:1em; top:.8em; float:right; } diff --git a/core/lostpassword/templates/lostpassword.php b/core/lostpassword/templates/lostpassword.php index dc9f0bc8ad3..c19c6893f13 100644 --- a/core/lostpassword/templates/lostpassword.php +++ b/core/lostpassword/templates/lostpassword.php @@ -1,17 +1,24 @@ -<form action="<?php echo OC_Helper::linkToRoute('core_lostpassword_send_email') ?>" method="post"> - <fieldset> - <?php echo $l->t('You will receive a link to reset your password via Email.'); ?> - <?php if ($_['requested']): ?> - <?php echo $l->t('Reset email send.'); ?> - <?php else: ?> +<?php if ($_['requested']): ?> + <div class="success"><p> + <?php + print_unescaped($l->t('The link to reset your password has been sent to your email.<br>If you do not receive it within a reasonable amount of time, check your spam/junk folders.<br>If it is not there ask your local administrator .')); + ?> + </p></div> +<?php else: ?> + <form action="<?php print_unescaped(OC_Helper::linkToRoute('core_lostpassword_send_email')) ?>" method="post"> + <fieldset> <?php if ($_['error']): ?> - <?php echo $l->t('Request failed!'); ?> + <div class="errors"><p> + <?php print_unescaped($l->t('Request failed!<br>Did you make sure your email/username was right?')); ?> + </p></div> <?php endif; ?> + <?php print_unescaped($l->t('You will receive a link to reset your password via Email.')); ?> <p class="infield"> - <label for="user" class="infield"><?php echo $l->t( 'Username' ); ?></label> <input type="text" name="user" id="user" placeholder="" value="" autocomplete="off" required autofocus /> + <label for="user" class="infield"><?php print_unescaped($l->t( 'Username' )); ?></label> + <img class="svg" src="<?php print_unescaped(image_path('', 'actions/user.svg')); ?>" alt=""/> </p> - <input type="submit" id="submit" value="<?php echo $l->t('Request reset'); ?>" /> - <?php endif; ?> - </fieldset> -</form> + <input type="submit" id="submit" value="<?php print_unescaped($l->t('Request reset')); ?>" /> + </fieldset> + </form> +<?php endif; ?> diff --git a/lib/request.php b/lib/request.php index 9f74cf9beb5..4d8380eb9ac 100755 --- a/lib/request.php +++ b/lib/request.php @@ -11,9 +11,10 @@ class OC_Request { * @brief Check overwrite condition * @returns true/false */ - private static function isOverwriteCondition() { + private static function isOverwriteCondition($type = '') { $regex = '/' . OC_Config::getValue('overwritecondaddr', '') . '/'; - return $regex === '//' or preg_match($regex, $_SERVER['REMOTE_ADDR']) === 1; + return $regex === '//' or preg_match($regex, $_SERVER['REMOTE_ADDR']) === 1 + or ($type !== 'protocol' and OC_Config::getValue('forcessl', false)); } /** @@ -27,7 +28,7 @@ class OC_Request { if(OC::$CLI) { return 'localhost'; } - if(OC_Config::getValue('overwritehost', '')<>'' and self::isOverwriteCondition()) { + if(OC_Config::getValue('overwritehost', '') !== '' and self::isOverwriteCondition()) { return OC_Config::getValue('overwritehost'); } if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { @@ -52,7 +53,7 @@ class OC_Request { * Returns the server protocol. It respects reverse proxy servers and load balancers */ public static function serverProtocol() { - if(OC_Config::getValue('overwriteprotocol', '')<>'' and self::isOverwriteCondition()) { + if(OC_Config::getValue('overwriteprotocol', '') !== '' and self::isOverwriteCondition('protocol')) { return OC_Config::getValue('overwriteprotocol'); } if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { @@ -76,7 +77,7 @@ class OC_Request { */ public static function requestUri() { $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; - if (OC_Config::getValue('overwritewebroot', '') <> '' and self::isOverwriteCondition()) { + if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) { $uri = self::scriptName() . substr($uri, strlen($_SERVER['SCRIPT_NAME'])); } return $uri; @@ -91,7 +92,7 @@ class OC_Request { */ public static function scriptName() { $name = $_SERVER['SCRIPT_NAME']; - if (OC_Config::getValue('overwritewebroot', '') <> '' and self::isOverwriteCondition()) { + if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) { $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -4)); $suburi = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen($serverroot))); $name = OC_Config::getValue('overwritewebroot', '') . $suburi; diff --git a/lib/templatelayout.php b/lib/templatelayout.php index 3c496f56e41..686a38a7386 100644 --- a/lib/templatelayout.php +++ b/lib/templatelayout.php @@ -64,25 +64,8 @@ class OC_TemplateLayout extends OC_Template { $root = $info[0]; $web = $info[1]; $file = $info[2]; - $paths = explode('/', $file); - $in_root = false; - foreach(OC::$APPSROOTS as $app_root) { - if($root == $app_root['path']) { - $in_root = true; - break; - } - } - - if($in_root ) { - $app = $paths[0]; - unset($paths[0]); - $path = implode('/', $paths); - $this->append( 'cssfiles', OC_Helper::linkTo($app, $path) . $versionParameter); - } - else { - $this->append( 'cssfiles', $web.'/'.$file); - } + $this->append( 'cssfiles', $web.'/'.$file . $versionParameter); } } @@ -123,20 +106,15 @@ class OC_TemplateLayout extends OC_Template { }elseif(self::appendIfExist($files, OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) { }else{ - $append = false; - // or in apps? - foreach( OC::$APPSROOTS as $apps_dir) - { - if(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style$fext.css")) { - $append = true; - break; - } - elseif(self::appendIfExist($files, $apps_dir['path'], $apps_dir['url'], "$style.css")) { - $append = true; - break; - } + $app = substr($style, 0, strpos($style, '/')); + $style = substr($style, strpos($style, '/')+1); + $app_path = OC_App::getAppPath($app); + $app_url = OC::$WEBROOT . '/index.php/apps/' . $app; + if(self::appendIfExist($files, $app_path, $app_url, "$style$fext.css")) { } - if(! $append) { + elseif(self::appendIfExist($files, $app_path, $app_url, "$style.css")) { + } + else { echo('css file not found: style:'.$style.' formfactor:'.$fext .' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); die(); @@ -195,18 +173,15 @@ class OC_TemplateLayout extends OC_Template { }else{ // Is it part of an app? - $append = false; - foreach( OC::$APPSROOTS as $apps_dir) { - if(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script$fext.js")) { - $append = true; - break; - } - elseif(self::appendIfExist($files, $apps_dir['path'], OC::$WEBROOT.$apps_dir['url'], "$script.js")) { - $append = true; - break; - } + $app = substr($script, 0, strpos($script, '/')); + $script = substr($script, strpos($script, '/')+1); + $app_path = OC_App::getAppPath($app); + $app_url = OC_App::getAppWebPath($app); + if(self::appendIfExist($files, $app_path, $app_url, "$script$fext.js")) { + } + elseif(self::appendIfExist($files, $app_path, $app_url, "$script.js")) { } - if(! $append) { + else { echo('js file not found: script:'.$script.' formfactor:'.$fext .' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT); die(); diff --git a/lib/user.php b/lib/user.php index b19af940795..226b716188d 100644 --- a/lib/user.php +++ b/lib/user.php @@ -527,7 +527,7 @@ class OC_User { foreach (self::$_usedBackends as $backend) { $backendDisplayNames = $backend->getDisplayNames($search, $limit, $offset); if (is_array($backendDisplayNames)) { - $displayNames = array_merge($displayNames, $backendDisplayNames); + $displayNames = $displayNames + $backendDisplayNames; } } asort($displayNames); |