1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-04 12:17:42 +02:00

Site Url without trailing slashes

This commit is contained in:
Евгений
2014-01-07 01:02:23 +06:00
parent 432942abf8
commit 3d83dc775f
15 changed files with 27 additions and 27 deletions

View File

@@ -62,7 +62,7 @@
<div class="container form-signin"> <div class="container form-signin">
<div style="text-align:center;"><a class="brand" href="<?php echo Option::get('siteurl'); ?>admin"><img src="<?php echo Option::get('siteurl'); ?>public/assets/img/monstra-logo.png" height="27" width="171" alt="monstra" /></a></div> <div style="text-align:center;"><a class="brand" href="<?php echo Option::get('siteurl'); ?>/admin"><img src="<?php echo Option::get('siteurl'); ?>/public/assets/img/monstra-logo.png" height="27" width="171" alt="monstra" /></a></div>
<div class="administration-area"> <div class="administration-area">
<hr> <hr>
<div> <div>

View File

@@ -19,18 +19,18 @@ ob_end_clean();
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>MonstraCMS::BLOG::RSS</title> <title>MonstraCMS::BLOG::RSS</title>
<link><?php echo Option::get('siteurl'); ?>blog</link> <link><?php echo Option::get('siteurl'); ?>/blog</link>
<description>The latest updates for <?php echo Option::get('sitename'); ?>.</description> <description>The latest updates for <?php echo Option::get('sitename'); ?>.</description>
<language>en-us</language> <language>en-us</language>
<pubDate><?php echo $now; ?></pubDate> <pubDate><?php echo $now; ?></pubDate>
<lastBuildDate><?php echo $now; ?></lastBuildDate> <lastBuildDate><?php echo $now; ?></lastBuildDate>
<atom:link href="<?php echo Option::get('siteurl'); ?>rss.php" rel="self" type="application/rss+xml" /> <atom:link href="<?php echo Option::get('siteurl'); ?>/rss.php" rel="self" type="application/rss+xml" />
<generator>Monstra</generator> <generator>Monstra</generator>
<?php foreach ($posts as $post) { ?> <?php foreach ($posts as $post) { ?>
<item> <item>
<title><?php echo $post['title']; ?></title> <title><?php echo $post['title']; ?></title>
<link><?php echo Option::get('siteurl').'blog/'.$post['slug']; ?></link> <link><?php echo Option::get('siteurl').'/blog/'.$post['slug']; ?></link>
<guid><?php echo Option::get('siteurl').'blog/'.$post['slug']; ?></guid> <guid><?php echo Option::get('siteurl').'/blog/'.$post['slug']; ?></guid>
<pubDate><?php echo Date::format($post['date'], 'd M Y'); ?></pubDate> <pubDate><?php echo Date::format($post['date'], 'd M Y'); ?></pubDate>
<description><![CDATA[<?php echo Text::toHtml(Text::cut(File::getContent(STORAGE . DS . 'pages' . DS . $post['id'] . '.page.txt'), 300)); ?>]]></description> <description><![CDATA[<?php echo Text::toHtml(Text::cut(File::getContent(STORAGE . DS . 'pages' . DS . $post['id'] . '.page.txt'), 300)); ?>]]></description>
<author><?php echo $post['author']; ?></author> <author><?php echo $post['author']; ?></author>

View File

@@ -1,5 +1,5 @@
<?php foreach($posts as $post) { ?> <?php foreach($posts as $post) { ?>
<a href="<?php echo Option::get('siteurl'); ?><?php echo Blog::$parent_page_name; ?>/<?php echo $post['slug']; ?>"><?php echo $post['title']; ?></a> <small class="monstra-blog-date"><?php echo Date::format($post['date'], 'd M Y'); ?></small><br> <a href="<?php echo Option::get('siteurl'); ?>/<?php echo Blog::$parent_page_name; ?>/<?php echo $post['slug']; ?>"><?php echo $post['title']; ?></a> <small class="monstra-blog-date"><?php echo Date::format($post['date'], 'd M Y'); ?></small><br>
<?php echo $post['content']; ?> <?php echo $post['content']; ?>
<br><br> <br><br>
<?php } ?> <?php } ?>

View File

@@ -1,5 +1,5 @@
<?php foreach($posts as $post) { ?> <?php foreach($posts as $post) { ?>
<a href="<?php echo Option::get('siteurl'); ?><?php echo Blog::$parent_page_name; ?>/<?php echo $post['slug'] ?>"><?php echo $post['title']; ?></a> <small class="monstra-blog-date"><?php echo Date::format($post['date'], 'd M Y'); ?></small><br> <a href="<?php echo Option::get('siteurl'); ?>/<?php echo Blog::$parent_page_name; ?>/<?php echo $post['slug'] ?>"><?php echo $post['title']; ?></a> <small class="monstra-blog-date"><?php echo Date::format($post['date'], 'd M Y'); ?></small><br>
<?php echo $post['content']; ?> <?php echo $post['content']; ?>
<br><br> <br><br>
<?php } ?> <?php } ?>

View File

@@ -2,6 +2,6 @@
<b><?php echo __('Related posts', 'blog'); ?>:</b> <b><?php echo __('Related posts', 'blog'); ?>:</b>
<div> <div>
<?php foreach($related_posts as $related_post) { ?> <?php foreach($related_posts as $related_post) { ?>
<a href="<?php echo Option::get('siteurl'); ?><?php echo Blog::$parent_page_name; ?>/<?php echo $related_post['slug']; ?>"><?php echo $related_post['title']; ?></a><br> <a href="<?php echo Option::get('siteurl'); ?>/<?php echo Blog::$parent_page_name; ?>/<?php echo $related_post['slug']; ?>"><?php echo $related_post['title']; ?></a><br>
<?php } ?> <?php } ?>
</div> </div>

View File

@@ -1,3 +1,3 @@
<?php foreach($tags as $tag) { ?> <?php foreach($tags as $tag) { ?>
<a href="<?php echo Option::get('siteurl'); ?><?php echo Blog::$parent_page_name; ?>?tag=<?php echo $tag; ?>"><span class="label label-important" data-original-title=""><?php echo $tag; ?></span></a> <a href="<?php echo Option::get('siteurl'); ?>/<?php echo Blog::$parent_page_name; ?>?tag=<?php echo $tag; ?>"><span class="label label-important" data-original-title=""><?php echo $tag; ?></span></a>
<?php } ?> <?php } ?>

View File

@@ -31,25 +31,25 @@ class FilesmanagerAdmin extends Backend
// Add slash if not exists // Add slash if not exists
if (substr($path, -1, 1) != '/') { if (substr($path, -1, 1) != '/') {
$path .= '/'; $path .= '/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path); Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
} }
// Upload corectly! // Upload corectly!
if ($path == 'uploads' || $path == 'uploads//') { if ($path == 'uploads' || $path == 'uploads//') {
$path = 'uploads/'; $path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path); Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
} }
// Only 'uploads' folder! // Only 'uploads' folder!
if (strpos($path, 'uploads') === false) { if (strpos($path, 'uploads') === false) {
$path = 'uploads/'; $path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path); Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
} }
// Set default path value if path is empty // Set default path value if path is empty
if ($path == '') { if ($path == '') {
$path = 'uploads/'; $path = 'uploads/';
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path); Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
} }
$files_path = ROOT . DS . 'public' . DS . $path; $files_path = ROOT . DS . 'public' . DS . $path;
@@ -85,7 +85,7 @@ class FilesmanagerAdmin extends Backend
if (Security::check(Request::get('token'))) { if (Security::check(Request::get('token'))) {
File::delete($files_path.Request::get('delete_file')); File::delete($files_path.Request::get('delete_file'));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path); Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
} else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); }
} }
@@ -97,7 +97,7 @@ class FilesmanagerAdmin extends Backend
if (Security::check(Request::get('token'))) { if (Security::check(Request::get('token'))) {
Dir::delete($files_path.Request::get('delete_dir')); Dir::delete($files_path.Request::get('delete_dir'));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path); Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
} else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); }
} }
@@ -111,7 +111,7 @@ class FilesmanagerAdmin extends Backend
if ($_FILES['file']) { if ($_FILES['file']) {
if ( ! in_array(File::ext($_FILES['file']['name']), $forbidden_types)) { if ( ! in_array(File::ext($_FILES['file']['name']), $forbidden_types)) {
move_uploaded_file($_FILES['file']['tmp_name'], $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name'])); move_uploaded_file($_FILES['file']['tmp_name'], $files_path.Security::safeName(basename($_FILES['file']['name'], File::ext($_FILES['file']['name'])), '-', true).'.'.File::ext($_FILES['file']['name']));
Request::redirect($site_url.'admin/index.php?id=filesmanager&path='.$path); Request::redirect($site_url.'/admin/index.php?id=filesmanager&path='.$path);
} }
} }

View File

@@ -486,7 +486,7 @@ class Page extends Pages
*/ */
public static function url() public static function url()
{ {
return Option::get('siteurl').Pages::$page['slug']; return Option::get('siteurl').'/'.Pages::$page['slug'];
} }
/** /**

View File

@@ -82,7 +82,7 @@ class Sitemap extends Frontend
$map .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n"; $map .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
foreach ($pages_list as $page) { foreach ($pages_list as $page) {
if ($page['parent'] != '') { $parent = $page['parent'].'/'; $priority = '0.5'; } else { $parent = ''; $priority = '1.0'; } if ($page['parent'] != '') { $parent = $page['parent'].'/'; $priority = '0.5'; } else { $parent = ''; $priority = '1.0'; }
$map .= "\t".'<url>'."\n\t\t".'<loc>'.Option::get('siteurl').$parent.$page['slug'].'</loc>'."\n\t\t".'<lastmod>'.date("Y-m-d", (int) $page['date']).'</lastmod>'."\n\t\t".'<changefreq>weekly</changefreq>'."\n\t\t".'<priority>'.$priority.'</priority>'."\n\t".'</url>'."\n"; $map .= "\t".'<url>'."\n\t\t".'<loc>'.Option::get('siteurl').'/'.$parent.$page['slug'].'</loc>'."\n\t\t".'<lastmod>'.date("Y-m-d", (int) $page['date']).'</lastmod>'."\n\t\t".'<changefreq>weekly</changefreq>'."\n\t\t".'<priority>'.$priority.'</priority>'."\n\t".'</url>'."\n";
} }
// Get list of components // Get list of components
@@ -91,7 +91,7 @@ class Sitemap extends Frontend
// Add components to sitemap // Add components to sitemap
if (count($components) > 0) { if (count($components) > 0) {
foreach ($components as $component) { foreach ($components as $component) {
$map .= "\t".'<url>'."\n\t\t".'<loc>'.Option::get('siteurl').Text::lowercase($component).'</loc>'."\n\t\t".'<lastmod>'.date("Y-m-d", time()).'</lastmod>'."\n\t\t".'<changefreq>weekly</changefreq>'."\n\t\t".'<priority>1.0</priority>'."\n\t".'</url>'."\n"; $map .= "\t".'<url>'."\n\t\t".'<loc>'.Option::get('siteurl').'/'.Text::lowercase($component).'</loc>'."\n\t\t".'<lastmod>'.date("Y-m-d", time()).'</lastmod>'."\n\t\t".'<changefreq>weekly</changefreq>'."\n\t\t".'<priority>1.0</priority>'."\n\t".'</url>'."\n";
} }
} }

View File

@@ -9,7 +9,7 @@
foreach ($pages_list as $page) { foreach ($pages_list as $page) {
if (trim($page['parent']) !== '') $parent = $page['parent'].'/'; else $parent = ''; if (trim($page['parent']) !== '') $parent = $page['parent'].'/'; else $parent = '';
if (trim($page['parent']) !== '') { echo '<ul>'."\n"; } if (trim($page['parent']) !== '') { echo '<ul>'."\n"; }
echo '<li><a href="'.Option::get('siteurl').$parent.$page['slug'].'">'.$page['title'].'</a></li>'."\n"; echo '<li><a href="'.Option::get('siteurl').'/'.$parent.$page['slug'].'">'.$page['title'].'</a></li>'."\n";
if (trim($page['parent']) !== '') { echo '</ul>'."\n"; } if (trim($page['parent']) !== '') { echo '</ul>'."\n"; }
} }
if (count($components) == 0) { echo '<ul>'."\n"; } if (count($components) == 0) { echo '<ul>'."\n"; }
@@ -21,7 +21,7 @@
if (count($components) > 0) { if (count($components) > 0) {
if (count($pages_list) == 0) { echo '<ul>'."\n"; } if (count($pages_list) == 0) { echo '<ul>'."\n"; }
foreach ($components as $component) { foreach ($components as $component) {
echo '<li><a href="'.Option::get('siteurl').$component.'">'.__(ucfirst($component), $component).'</a></li>'."\n"; echo '<li><a href="'.Option::get('siteurl').'/'.$component.'">'.__(ucfirst($component), $component).'</a></li>'."\n";
} }
if (count($pages_list) == 0) { echo '</ul>'."\n"; } if (count($pages_list) == 0) { echo '</ul>'."\n"; }
} }

View File

@@ -155,7 +155,7 @@ class Users extends Frontend
$mail->Send(); $mail->Send();
// Redirect to user profile // Redirect to user profile
Request::redirect(Option::get('siteurl').'users/'.Users::$users->lastId()); Request::redirect(Option::get('siteurl').'/users/'.Users::$users->lastId());
} }
} else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); } } else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); }

View File

@@ -6,7 +6,7 @@ Your new details are as follows:
Username: <?php echo $user_login; ?><br> Username: <?php echo $user_login; ?><br>
Password: <?php echo $new_password; ?> Password: <?php echo $new_password; ?>
<br><br> <br><br>
To change your password, please visit this page: <a href="<?php echo $site_url; ?>users/<?php echo $user_id; ?>" style="color:#333; text-decoration:underline;"><?php echo $site_url; ?>users/<?php echo $user_id; ?></a> To change your password, please visit this page: <a href="<?php echo $site_url; ?>/users/<?php echo $user_id; ?>" style="color:#333; text-decoration:underline;"><?php echo $site_url; ?>/users/<?php echo $user_id; ?></a>
<br><br> <br><br>
All the best,<br> All the best,<br>
<?php echo $site_name; ?> <?php echo $site_name; ?>

View File

@@ -4,14 +4,14 @@ You have requested to reset your password on <?php echo $site_name; ?> because y
If you did not request this, please ignore it. If you did not request this, please ignore it.
<br><br> <br><br>
To reset your password, please visit the following page:<br> To reset your password, please visit the following page:<br>
<a href="<?php echo $site_url; ?>users/password-reset?hash=<?php echo $new_hash; ?>" style="color:#333; text-decoration:underline;"><?php echo $site_url; ?>users/password-reset?hash=<?php echo $new_hash; ?></a> <a href="<?php echo $site_url; ?>/users/password-reset?hash=<?php echo $new_hash; ?>" style="color:#333; text-decoration:underline;"><?php echo $site_url; ?>/users/password-reset?hash=<?php echo $new_hash; ?></a>
<br><br> <br><br>
When you visit that page, your password will be reset, and the new password will be emailed to you. When you visit that page, your password will be reset, and the new password will be emailed to you.
<br><br> <br><br>
Your username is: <?php echo $user_login; ?> Your username is: <?php echo $user_login; ?>
<br><br> <br><br>
To edit your profile, go to this page:<br> To edit your profile, go to this page:<br>
<a href="<?php echo $site_url ?>users/<?php echo $user_id; ?>" style="color:#333; text-decoration:underline;"><?php echo $site_url ?>users/<?php echo $user_id; ?></a> <a href="<?php echo $site_url ?>/users/<?php echo $user_id; ?>" style="color:#333; text-decoration:underline;"><?php echo $site_url ?>/users/<?php echo $user_id; ?></a>
<br><br> <br><br>
All the best,<br> All the best,<br>
<?php echo $site_name; ?> <?php echo $site_name; ?>

View File

@@ -5,5 +5,5 @@
<?php echo Form::hidden('csrf', Security::token()); ?> <?php echo Form::hidden('csrf', Security::token()); ?>
<label><?php echo __('Username', 'users'); ?></label><input name="username" type="text" class="input-large" /> <label><?php echo __('Username', 'users'); ?></label><input name="username" type="text" class="input-large" />
<label><?php echo __('Password', 'users'); ?></label><input name="password" type="password" class="input-large" /> <label><?php echo __('Password', 'users'); ?></label><input name="password" type="password" class="input-large" />
<br><input name="login_submit" class="btn" type="submit" value="<?php echo __('Log In', 'users'); ?>" /> <a class="small-grey-text reset-password-btn" href="<?php echo Option::get('siteurl').'users/password-reset'; ?>"><?php echo __('Forgot your password?', 'users');?></a> <br><input name="login_submit" class="btn" type="submit" value="<?php echo __('Log In', 'users'); ?>" /> <a class="small-grey-text reset-password-btn" href="<?php echo Option::get('siteurl').'/users/password-reset'; ?>"><?php echo __('Forgot your password?', 'users');?></a>
</form> </form>

View File

@@ -20,7 +20,7 @@ Plugin::register( __FILE__,
'http://monstra.org/'); 'http://monstra.org/');
// Set crypt captcha path to images // Set crypt captcha path to images
$cryptinstall = Option::get('siteurl').'plugins/captcha/crypt/images/'; $cryptinstall = Option::get('siteurl').'/plugins/captcha/crypt/images/';
// Include Crypt Captcha // Include Crypt Captcha
include PLUGINS . DS . 'captcha/crypt/cryptographp.fct.php'; include PLUGINS . DS . 'captcha/crypt/cryptographp.fct.php';