Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into bugs3
Browse files Browse the repository at this point in the history
  • Loading branch information
xillibit committed Apr 13, 2012
2 parents 9581625 + 5742ea4 commit e4ad8b4
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 60 deletions.
10 changes: 4 additions & 6 deletions administrator/components/com_kunena/libraries/bbcode/bbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function __construct() {
$this->SetSmileyURL ( JURI::root(true) );
$this->SetDetectURLs ( true );
$this->SetURLPattern (array($this, 'parseUrl'));
$this->SetURLTarget('_blank');
}

/**
Expand Down Expand Up @@ -138,7 +139,7 @@ public function parseUrl($params) {
}
}

return "<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$text}</a>";
return "<a class=\"bbcode_url\" href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$text}</a>";
}
}

Expand Down Expand Up @@ -713,11 +714,8 @@ function DoURL($bbcode, $action, $name, $default, $params, $content) {
echo "ISVALIDURL<br />";
if ($bbcode->url_targetable !== false && isset ( $params ['target'] ))
$target = " target=\"" . htmlspecialchars ( $params ['target'] ) . "\"";
else
$target = "";
if ($bbcode->url_target !== false)
if (! ($bbcode->url_targetable == 'override' && isset ( $params ['target'] )))
$target = " target=\"" . htmlspecialchars ( $bbcode->url_target ) . "\"";
elseif ($bbcode->url_target !== false)
$target = " target=\"" . htmlspecialchars ( $bbcode->url_target ) . "\"";
return '<a href="' . htmlspecialchars ( $url ) . '" class="bbcode_url" rel="nofollow"' . $target . '>' . $content . '</a>';
}
return htmlspecialchars ( $params ['_tag'] ) . $content . htmlspecialchars ( $params ['_endtag'] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ protected function editorActionJs($name) {
$js .= "\n this.wrapSelection('[{$tag}]', '[/{$tag}]', false);";
} else {
$start = $action['start'] ? $action['start'] : "[{$action['tag']}]";
$end = $action['end'] ? $action['end'] : "[{$action['tag']}]";
$end = $action['end'] ? $action['end'] : "[/{$action['tag']}]";
$js .= "\nselection = this.getSelection();
if (selection) {
this.processEachLine(function(line) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public function delete() {
$access->clearCache();

$db = JFactory::getDBO ();
$queries[] = "DELETE FROM #__kunena_aliases WHERE type='catid' AND c.id={$db->quote($this->id)}";
$queries[] = "DELETE FROM #__kunena_aliases WHERE type='catid' AND id={$db->quote($this->id)}";
// Delete user topics
$queries[] = "DELETE FROM #__kunena_user_topics WHERE category_id={$db->quote($this->id)}";
// Delete user categories
Expand Down
2 changes: 2 additions & 0 deletions administrator/components/com_kunena/libraries/menu/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ protected static function getList15(JRegistry &$params) {
$tmp->sublevel = $item->sublevel;
$tmp->tree = $item->tree;
$item = $tmp;
} else {
$item = clone($item);
}
} else {
$item = clone($item);
Expand Down
15 changes: 5 additions & 10 deletions components/com_kunena/controllers/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ public function save() {
return;
}

// FIXME: $this->saveUser() doesn't work either in J!1.5 or J!2.5
$this->app->enqueueMessage('TODO: Save changes to user account!', 'error');
//$this->saveUser();

$this->saveUser();
$this->saveProfile();
$this->saveAvatar();
$this->saveSettings();
Expand Down Expand Up @@ -285,9 +282,8 @@ protected function karma($karmaDelta) {
}

// Mostly copied from Joomla 1.5
protected function saveUser()
{
$user = KunenaFactory::getUser(JRequest::getInt ( 'userid', 0 ));
protected function saveUser(){
$user = JUser::getInstance(JRequest::getInt ( 'userid', 0 ));

// we don't want users to edit certain fields so we will ignore them
$ignore = array('id', 'gid', 'block', 'usertype', 'registerDate', 'activation');
Expand Down Expand Up @@ -335,7 +331,7 @@ protected function saveUser()
}
}

$username = $this->user->username;
$username = $this->me->username;

// Bind the form fields to the user table
if (!$user->bind($post)) {
Expand All @@ -353,8 +349,7 @@ protected function saveUser()
$session->set('user', $user);

// update session if username has been changed
if ( $username && $username != $user->username )
{
if ( $username && $username != $user->username ){
$table = JTable::getInstance('session', 'JTable' );
$table->load($session->getId());
$table->username = $user->username;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function kunenaValidate(f) { return document.formvalidator.isValid(f); }
<div>
<label>
<?php echo JText::_('COM_KUNENA_ANN_DATE') ?>:
<?php echo $this->displayInput('created', 'addcreated') ?>
<?php echo $this->displayInput('created', 'addcreated', 'kanncreated') ?>
</label>
<label>
<?php echo JText::_('COM_KUNENA_ANN_SHOWDATE') ?>:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<form action="<?php echo KunenaRoute::_('index.php?option=com_kunena') ?>" method="post" name="kuserform" class="form-validate" enctype="multipart/form-data">
<input type="hidden" name="view" value="user" />
<input type="hidden" name="task" value="save" />
<input type="hidden" name="userid" value="<?php echo $this->user->id ?>" />
<?php echo JHTML::_( 'form.token' ); ?>

<div id="kprofile-edit">
Expand Down
27 changes: 15 additions & 12 deletions components/com_kunena/template/blue_eagle/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
Element.implement({

getSelectedText: function() {
if(Browser.Engine.trident){
if (typeof this.selectionStart != "undefined") {
return this.get('value').substring(this.selectionStart, this.selectionEnd);
}
if(typeof document.selection != "undefined") {
// Something for IE
this.focus();
return document.selection.createRange().text;
}
return this.get('value').substring(this.selectionStart, this.selectionEnd);
return '';
},

wrapSelectedText: function(newtext, wrapperLeft, wrapperRight, isLast) {
Expand All @@ -33,24 +37,23 @@ Element.implement({
var scroll_top = this.scrollTop;

this.focus();
if(Browser.Engine.trident) {
var range = document.selection.createRange();
range.text = wrapperLeft + newtext + wrapperRight;
if(isLast) {
range.select();
}
}
else {
if(typeof this.selectionStart != "undefined") {
var originalStart = this.selectionStart;
var originalEnd = this.selectionEnd;
this.value = this.get('value').substring(0, originalStart) + wrapperLeft + newtext + wrapperRight + this.get('value').substring(originalEnd);
if(isLast == false) {
this.setSelectionRange(originalStart + wrapperLeft.length, originalStart + wrapperLeft.length + newtext.length);
}
else {
} else {
var position = originalStart + newtext.length + wrapperLeft.length + wrapperRight.length;
this.setSelectionRange(position, position);
}
} else if(typeof document.selection != "undefined") {
// Something for IE
var range = document.selection.createRange();
range.text = wrapperLeft + newtext + wrapperRight;
if(isLast) {
range.select();
}
}
this.scrollTop = scroll_top;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function kunenaValidate(f) { return document.formvalidator.isValid(f); }
</label>
</div>
<div class="form-field">
<?php echo $this->displayInput('created', 'addcreated') ?>
<?php echo $this->displayInput('created', 'addcreated', 'kanncreated') ?>
</div>
</li>
<li class="announcement-row kbox-hover kbox-hover_list-row">
Expand Down
3 changes: 2 additions & 1 deletion components/com_kunena/template/mirage/html/user/edit_tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
<div class="detailsbox kbox-full">
<input type="hidden" name="view" value="user" />
<input type="hidden" name="task" value="save" />
<input type="hidden" name="userid" value="<?php echo $this->user->id ?>" />
<?php echo JHTML::_( 'form.token' ); ?>

<dl class="ktabs">
<dt class="open"><a class="link-tab" title="<?php echo JText::_('COM_KUNENA_PROFILE_EDIT_USER') ?>" href="#tab-edit_user"><?php echo JText::_('COM_KUNENA_PROFILE_EDIT_USER') ?></a></dt>
<dd style="display: none;">
Expand Down
27 changes: 15 additions & 12 deletions components/com_kunena/template/mirage/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
Element.implement({

getSelectedText: function() {
if(Browser.Engine.trident){
if (typeof this.selectionStart != "undefined") {
return this.get('value').substring(this.selectionStart, this.selectionEnd);
}
if(typeof document.selection != "undefined") {
// Something for IE
this.focus();
return document.selection.createRange().text;
}
return this.get('value').substring(this.selectionStart, this.selectionEnd);
return '';
},

wrapSelectedText: function(newtext, wrapperLeft, wrapperRight, isLast) {
Expand All @@ -33,24 +37,23 @@ Element.implement({
var scroll_top = this.scrollTop;

this.focus();
if(Browser.Engine.trident) {
var range = document.selection.createRange();
range.text = wrapperLeft + newtext + wrapperRight;
if(isLast) {
range.select();
}
}
else {
if(typeof this.selectionStart != "undefined") {
var originalStart = this.selectionStart;
var originalEnd = this.selectionEnd;
this.value = this.get('value').substring(0, originalStart) + wrapperLeft + newtext + wrapperRight + this.get('value').substring(originalEnd);
if(isLast == false) {
this.setSelectionRange(originalStart + wrapperLeft.length, originalStart + wrapperLeft.length + newtext.length);
}
else {
} else {
var position = originalStart + newtext.length + wrapperLeft.length + wrapperRight.length;
this.setSelectionRange(position, position);
}
} else if(typeof document.selection != "undefined") {
// Something for IE
var range = document.selection.createRange();
range.text = wrapperLeft + newtext + wrapperRight;
if(isLast) {
range.select();
}
}
this.scrollTop = scroll_top;
},
Expand Down
23 changes: 8 additions & 15 deletions components/com_kunena/views/topic/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,22 +658,15 @@ function getMessageActions() {
$this->messageButtons->set('report', $this->getButton ( sprintf($layout, 'report'), 'report', 'message', 'user'));
}

if ($this->me->isModerator ( $this->topic->category_id )) {
// Moderator buttons
$this->messageButtons->set('edit', $this->getButton ( sprintf($layout, 'edit'), 'edit', 'message', 'moderation'));
$this->messageButtons->set('moderate', $this->getButton ( sprintf($layout, 'moderate'), 'moderate', 'message', 'moderation'));
$this->message->hold == 1 ? $this->messageButtons->set('publish', $this->getButton ( sprintf($task, 'approve'), 'approve', 'message', 'moderation')) : null;

if ($this->message->hold == 2 || $this->message->hold == 3) {
$this->messageButtons->set('undelete', $this->getButton ( sprintf($task, 'undelete'), 'undelete', 'message', 'moderation'));
$this->messageButtons->set('permdelete', $this->getButton ( sprintf($task, 'permdelete'), 'permdelete', 'message', 'permanent'));
} else {
$this->messageButtons->set('delete', $this->getButton ( sprintf($task, 'delete'), 'delete', 'message', 'moderation'));
}

// Moderation and own post actions
$this->message->authorise('edit') ? $this->messageButtons->set('edit', $this->getButton ( sprintf($layout, 'edit'), 'edit', 'message', 'moderation')) : null;
$this->message->authorise('move') ? $this->messageButtons->set('moderate', $this->getButton ( sprintf($layout, 'moderate'), 'moderate', 'message', 'moderation')) : null;
if ($this->message->hold == 1) {
$this->message->authorise('approve') ? $this->messageButtons->set('publish', $this->getButton ( sprintf($task, 'approve'), 'approve', 'message', 'moderation')) : null;
} elseif ($this->message->hold == 2 || $this->message->hold == 3) {
$this->message->authorise('undelete') ? $this->messageButtons->set('undelete', $this->getButton ( sprintf($task, 'undelete'), 'undelete', 'message', 'moderation')) : null;
$this->message->authorise('permdelete') ? $this->messageButtons->set('permdelete', $this->getButton ( sprintf($task, 'permdelete'), 'permdelete', 'message', 'permanent')) : null;
} else {
// Allow user to edit and delete his post
$this->message->authorise('edit') ? $this->messageButtons->set('edit', $this->getButton ( sprintf($layout, 'edit'), 'edit', 'message', 'moderation')) : null;
$this->message->authorise('delete') ? $this->messageButtons->set('delete', $this->getButton ( sprintf($task, 'delete'), 'delete', 'message', 'moderation')) : null;
}

Expand Down

0 comments on commit e4ad8b4

Please sign in to comment.