Remove reserved characters from URL, changes on labels

This commit is contained in:
Diego Najar 2018-08-20 22:32:14 +02:00
parent a3df822c65
commit e674327a25
8 changed files with 16 additions and 6 deletions

View File

@ -64,7 +64,12 @@ class dbList extends dbJSON
public function generateKey($name) public function generateKey($name)
{ {
global $L;
$key = Text::cleanUrl($name); $key = Text::cleanUrl($name);
if (Text::isEmpty($key)) {
$key = $L->g('empty');
}
while (isset($this->db[$key])) { while (isset($this->db[$key])) {
$key++; $key++;
} }

View File

@ -118,7 +118,7 @@ function table($type) {
.'</a> .'</a>
</div> </div>
<div> <div>
<p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?'Position: '.$page->position():$page->relativeTime() ).'</p> <p style="font-size: 0.8em" class="m-0 text-uppercase text-muted">'.( ((ORDER_BY=='position') || ($type!='published'))?'Position: '.$page->position():$page->date(MANAGE_CONTENT_DATE_FORMAT) ).'</p>
</div> </div>
</td>'; </td>';

View File

@ -6,7 +6,7 @@
<a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true"><?php $L->p('Editor') ?></a> <a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true"><?php $L->p('Editor') ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false"><?php $L->p('Images') ?></a> <a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false"><?php $L->p('Cover images') ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link " id="options-tab" data-toggle="tab" href="#options" role="tab" aria-controls="options" aria-selected="false"><?php $L->p('Options') ?></a> <a class="nav-link " id="options-tab" data-toggle="tab" href="#options" role="tab" aria-controls="options" aria-selected="false"><?php $L->p('Options') ?></a>

View File

@ -6,7 +6,7 @@
<a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true"><?php $L->p('Editor') ?></a> <a class="nav-link active" id="content-tab" data-toggle="tab" href="#content" role="tab" aria-controls="content" aria-selected="true"><?php $L->p('Editor') ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false"><?php $L->p('Images') ?></a> <a class="nav-link" id="images-tab" data-toggle="tab" href="#images" role="tab" aria-controls="images" aria-selected="false"><?php $L->p('Cover images') ?></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link " id="options-tab" data-toggle="tab" href="#options" role="tab" aria-controls="options" aria-selected="false"><?php $L->p('Options') ?></a> <a class="nav-link " id="options-tab" data-toggle="tab" href="#options" role="tab" aria-controls="options" aria-selected="false"><?php $L->p('Options') ?></a>

View File

@ -80,6 +80,9 @@ define('SCHEDULED_DATE_FORMAT', 'D, j M Y, H:i');
// Notifications date format // Notifications date format
define('NOTIFICATIONS_DATE_FORMAT', 'D, j M Y, H:i'); define('NOTIFICATIONS_DATE_FORMAT', 'D, j M Y, H:i');
// Manage content date format
define('MANAGE_CONTENT_DATE_FORMAT', 'D, j M Y, H:i');
// Amount of items to show on notification panel // Amount of items to show on notification panel
define('NOTIFICATIONS_AMOUNT', 10); define('NOTIFICATIONS_AMOUNT', 10);

View File

@ -131,7 +131,7 @@ class Text {
if (EXTREME_FRIENDLY_URL) { if (EXTREME_FRIENDLY_URL) {
$string = self::lowercase($string); $string = self::lowercase($string);
$string = trim($string, $separator); $string = trim($string, $separator);
$string = preg_replace("/[\/_|+:!@#$%^&*(). -]+/", $separator, $string); $string = preg_replace("/[\/_|+:!@#$%^&*()';=,?\[\]~. -]+/", $separator, $string);
$string = trim($string, $separator); $string = trim($string, $separator);
return $string; return $string;
} }

View File

@ -645,6 +645,8 @@ class Pages extends dbJSON {
// Generate a valid Key/Slug // Generate a valid Key/Slug
public function generateKey($text, $parent=false, $returnSlug=false, $oldKey='') public function generateKey($text, $parent=false, $returnSlug=false, $oldKey='')
{ {
global $L;
if (Text::isEmpty($text)) { if (Text::isEmpty($text)) {
$text = 'empty'; $text = 'empty';
} }
@ -657,7 +659,7 @@ class Pages extends dbJSON {
// cleanURL can return empty string // cleanURL can return empty string
if (Text::isEmpty($newKey)) { if (Text::isEmpty($newKey)) {
$newKey = 'empty'; $key = $L->g('empty');
} }
if ($newKey!==$oldKey) { if ($newKey!==$oldKey) {