Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes v7 #8

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions system/user/addons/wiki/Model/Wiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ public function validateEmails($key, $value, $params, $rule)

public function validateShortName($key, $value, $params, $rule)
{
if (empty($value)) {
return '';
}

if (preg_match('/[^a-z0-9\-\_]/i', $value))
{
return 'invalid_short_name';
Expand Down
2 changes: 1 addition & 1 deletion system/user/addons/wiki/Model/WikiNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class WikiNamespace extends Model {

protected static $_validation_rules = array(
'namespace_name' => 'required|validateShortName|uniqueWithinSiblings[Wiki,WikiNamespaces]',
'namespace_label' => 'required|uniqueWithinSiblings[Wiki,WikiNamespaces]]'
'namespace_label' => 'required|uniqueWithinSiblings[Wiki,WikiNamespaces]'
);


Expand Down
2 changes: 1 addition & 1 deletion system/user/addons/wiki/addon.setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'author_url' => 'https://expressionengine.com/',
'name' => 'Wiki',
'description' => '',
'version' => '5.0.0',
'version' => '5.0.1',
'namespace' => 'User\Addons\Wiki',
'settings_exist' => TRUE,
'docs_url' => 'https://github.com/EllisLab/Wiki/wiki',
Expand Down
15 changes: 13 additions & 2 deletions system/user/addons/wiki/mod.wiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Wiki {
// Settings
var $wiki_id = 1;
var $label_name = 'EE Wiki';
var $short_name = 'ee_wiki';
var $use_captchas = 'n';
var $text_format = 'xhtml';
var $html_format = 'safe';
Expand Down Expand Up @@ -655,7 +656,7 @@ function _fetch_template($which)
/** Redirect for the Wiki
/** ----------------------------------------*/

public function redirect($namespace='', $title)
public function redirect($namespace='', $title='')
{
ee()->functions->redirect($this->create_url($namespace, $title));
exit;
Expand All @@ -667,8 +668,10 @@ public function redirect($namespace='', $title)
/** Creat URL for the Wiki
/** ----------------------------------------*/

function create_url($namespace='', $title)
function create_url($namespace='', $title='')
{
if ($title == '') { return ''; }

if ($namespace == '' && stristr($title, ':') && count($this->namespaces) > 0)
{
foreach($this->namespaces as $possible)
Expand Down Expand Up @@ -720,6 +723,10 @@ function prep_screen_name($str)

function prep_title($str)
{
if (empty($str)) {
return '';
}

if (ee()->config->item('word_separator') == 'dash')
{
return str_replace(array('-', $this->cats_separator), array(' ', $this->cats_display_separator), $str);
Expand All @@ -738,6 +745,10 @@ function prep_title($str)

public function valid_title($str)
{
if (empty($str)) {
return '';
}

// Remove all numeric entities
$str = preg_replace('/&#x([0-9a-f]{2,5});{0,1}|&#([0-9]{2,4});{0,1}/', '', $str);

Expand Down
2 changes: 1 addition & 1 deletion system/user/addons/wiki/upd.wiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class Wiki_upd {

var $version = '5.0.0';
var $version = '5.0.1';

/**
* Module Installer
Expand Down