Matthew Hawley
New member
Hello. Could somebody show me how to remove these lines?
<?php
/*======================================================================*\
|| #################################################################### ||
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2007-2009 Fillip H. # ||
|| # All Rights Reserved. # ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------------------------------------------------------- # ||
|| # You are not allowed to use this on your server unless the files # ||
|| # you downloaded were done so with permission. # ||
|| # ---------------------------------------------------------------- # ||
|| #################################################################### ||
\*======================================================================*/
class DBTech_xFShout_ControllerPublic_Shout extends XenForo_ControllerPublic_Abstract
{
/**
* View top x stats
* @return XenForo_ControllerResponse_View
*/
public function actionIndex()
{
$input = $this->_input->filter(array(
'instanceid' => XenForo_Input::UINT,
'chatroomid' => XenForo_Input::UINT,
));
// Create some needed arrays
$instances = $this->_getCacheModel()->get('dbtech_xfshout_instance');
$permissions = $this->_getCacheModel()->get('dbtech_xfshout_instperms');
$visitor = XenForo_Visitor::getInstance()->toArray();
// Assert whether we are banned
$this->_assertBanned($visitor);
// Assert instance id
$this->_assertInstanceId($input['instanceid']);
// Get effective permissions
$this->_getShoutModel()->getEffectivePermissions($visitor, $permissions);
// Grab effective permissions
$effectivePermissions = $visitor['permissions']['dbtech_xfshout'][$input['instanceid']];
// Assert if we can post shouts
$this->_assertPermissions($effectivePermissions, 'canview');
// Ensure this is set
$instance = $instances[$input['instanceid']];
$instance['options'] = @unserialize($instance['options']);
// Get all shouts
$shouts = $this->_getShoutModel()->getShouts($input['instanceid'], $input['chatroomid'], $instance['options']['numshouts']);
foreach ($shouts as &$shout)
{
// Parse the dateline properly -.-
$shout['dateline_parsed'] = XenForo_Locale::dateTime($shout['dateline'], 'relative');
if (preg_match("#^(\/[a-z]*?)\s(.+?)$#i", $shout['message_parsed'], $matches))
{
// 2-stage command
switch ($matches[1])
{
case '/me':
// A slash me
$shout['message_parsed'] = trim($matches[2]);
$shout['type'] = $this->_getShoutModel()->getShoutType('me');
break;
default:
//($hook = vBulletinHook::fetch_hook('dbtech_vbshout_parsecommand_2')) ? eval($hook) : false;
break;
}
}
}
//XenForo_Application::get('options')->dbtech_xfshout_limit
$viewParams = array(
'shouts' => $shouts,
'sticky' => $instance['sticky'],
'stickyParsed' => $instance['sticky_parsed'],
'instanceid' => $input['instanceid'],
'permissions' => $effectivePermissions,
'visitor' => $visitor
);
return $this->responseView('DBTech_xFShout_ViewPublic_Shout', 'dbtech_xfshout_shouts', $viewParams);
}
/**
* Submits a new shout or returns current shouts
* @return XenForo_ControllerResponse_View
*/
public function actionAdd()
{
$input = $this->_input->filter(array(
'shout' => XenForo_Input::STRING,
'shoutid' => XenForo_Input::UINT,
'instanceid' => XenForo_Input::UINT,
'chatroomid' => XenForo_Input::UINT,
'onlyadd' => XenForo_Input::UINT,
));
if (!empty($input['shout']))
{
// Actually adding a shout can only come from POST
$this->_assertPostOnly();
// Create some needed arrays
$instances = $this->_getCacheModel()->get('dbtech_xfshout_instance');
$permissions = $this->_getCacheModel()->get('dbtech_xfshout_instperms');
$visitor = XenForo_Visitor::getInstance()->toArray();
// Assert whether we are banned
$this->_assertBanned($visitor);
// Assert instance id
$this->_assertInstanceId($input['instanceid']);
// Get effective permissions
$this->_getShoutModel()->getEffectivePermissions($visitor, $permissions);
// Grab effective permissions
$effectivePermissions = $visitor['permissions']['dbtech_xfshout'][$input['instanceid']];
// Pass the string through various helpers
$input['shout'] = XenForo_Helper_String::censorString($input['shout']);
// Create the new BBCode Formatter object
$formatter = XenForo_BbCode_Formatter_Base::create('DBTech_xFShout_BbCode_Shout');
$instance = $instances[$input['instanceid']];
$instance['options'] = @unserialize($instance['options']);
$instance['bbcode'] = @unserialize($instance['bbcode']);
$bbcode = array();
foreach ($instance['bbcode'] as $bbcodeid => $onoff)
{
if (!$onoff)
{
// Disabled BBCode
continue;
}
// Add this to allowed tags
$bbcode[] = $bbcodeid;
}
// Override the list of BBCode Tags allowed based on per-instance options
$formatter->setTags($bbcode);
// Create the BBCode Parser
$parser = new XenForo_BbCode_Parser($formatter);
// Construct a dummy array to keep the wrapper happy
$messages = array(0 => array('message' => $input['shout']));
// Do BBCode conversion
$messages[0]['message'] = XenForo_Helper_String::autoLinkBbCode($messages[0]['message']);
XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($messages, $parser);
// Init the datawriter
$dw = XenForo_DataWriter::create('DBTech_xFShout_DataWriter_Shout');
$dw->setOption('effectivePermissions', $effectivePermissions);
$dw->setErrorHandler(XenForo_DataWriter::ERROR_ARRAY);
if (!$input['shoutid'])
{
// Assert if we can post shouts
$this->_assertPermissions($effectivePermissions, 'canshout');
// Set some new-only values
$dw->set('userid', XenForo_Visitor::getUserId());
$dw->set('instanceid', $input['instanceid']);
$dw->set('chatroomid', $input['chatroomid']);
}
else
{
// We're potentially editing a shout
$dw->setExistingData($input['shoutid']);
if ($dw->get('userid') == $visitor['user_id'])
{
// Assert if we can edit own shouts
$this->_assertPermissions($effectivePermissions, 'caneditown');
}
else
{
// Assert if we can post shouts
$this->_assertPermissions($effectivePermissions, 'caneditothers');
}
}
// Set the rest of the (always changed) data
$dw->set('message', strip_tags($input['shout']));
$dw->set('message_parsed', strip_tags($messages[0]['messageHtml']->__toString()));
$shoutid = $dw->save();
if (!$shoutid)
{
// Fling me sum error
throw $this->responseException(
$this->responseError(implode('<br />', $dw->getErrors()), 500)
);
}
}
return ($input['onlyadd'] ? true : $this->actionIndex());
}
/**
* Deletes a shout.
* @return XenForo_ControllerResponse_View
*/
public function actionDelete()
{
$input = $this->_input->filter(array(
'shoutid' => XenForo_Input::UINT,
'instanceid' => XenForo_Input::UINT,
'chatroomid' => XenForo_Input::UINT,
'onlydelete' => XenForo_Input::UINT,
));
// Actually adding a shout can only come from POST
$this->_assertPostOnly();
// Create some needed arrays
$instances = $this->_getCacheModel()->get('dbtech_xfshout_instance');
$permissions = $this->_getCacheModel()->get('dbtech_xfshout_instperms');
$visitor = XenForo_Visitor::getInstance()->toArray();
// Assert whether we are banned
$this->_assertBanned($visitor);
// Assert instance id
$this->_assertInstanceId($input['instanceid']);
// Get effective permissions
$this->_getShoutModel()->getEffectivePermissions($visitor, $permissions);
// Grab effective permissions
$effectivePermissions = $visitor['permissions']['dbtech_xfshout'][$input['instanceid']];
// Init the datawriter
$dw = XenForo_DataWriter::create('DBTech_xFShout_DataWriter_Shout');
$dw->setOption('effectivePermissions', $effectivePermissions);
$dw->setErrorHandler(XenForo_DataWriter::ERROR_ARRAY);
$dw->setExistingData($input['shoutid']);
if ($dw->get('userid') == $visitor['user_id'])
{
// Assert if we can edit own shouts
$this->_assertPermissions($effectivePermissions, 'caneditown');
}
else
{
// Assert if we can post shouts
$this->_assertPermissions($effectivePermissions, 'caneditothers');
}
$dw->delete();
return ($input['onlydelete'] ? true : $this->actionIndex());
}
/**
* Helper to assert that this action is available with a valid instance id.
* Throws an exception if the request doesn't carry an instance id or it's invalid
*
* @param integer The instance ID to check.
*/
protected function _assertInstanceId($instance_id)
{
$instances = $this->_getCacheModel()->get('dbtech_xfshout_instance');
if (!isset($instances[$instance_id]))
{
throw $this->responseException(
$this->responseError(new XenForo_Phrase('dbtech_xfshout_invalid_instanceid'), 500)
);
}
}
/**
* Helper to assert that this action is unavailable if banned.
* Throws an exception if the user is banned
*
* @param integer The visitor to check.
*/
protected function _assertBanned($visitor)
{
if ($visitor['dbtech_xfshout_banned'])
{
throw $this->responseException(
$this->responseError(new XenForo_Phrase('dbtech_xfshout_banned'), 500)
);
}
}
/**
* Helper to assert that this action is available with a valid permission.
* Throws an exception if the visitor doesn't have the required permissions.
*
* @param array The visitor's permissions
* @param string The type of action we're doing
*/
protected function _assertPermissions($permissions, $type)
{
if (!$permissions[$type])
{
throw $this->responseException(
$this->responseError(new XenForo_Phrase('dbtech_xfshout_no_permissions_' . $type), 500)
);
}
}
/**
* Grabs the xFShout model from the cache.
*
* @return DBTech_xFShout_Model_Shout
*/
protected function _getShoutModel()
{
return $this->getModelFromCache('DBTech_xFShout_Model_Shout');
}
/**
* Grabs the Cache model from the cache.
*
* @return XenForo_Model_DataRegistry
*/
protected function _getCacheModel()
{
return $this->getModelFromCache('XenForo_Model_DataRegistry');
}
}
Now, that you've started doing xenforo add-ons are you going to add vbshout's feature's to xfshout, and add a xfshout support forum?
It's on the long term plan, but not in the schedule for the next month or so. We won't know exactly what the roadmap is regarding XenForo until we have some solid sales figures from our first 2 XF mods in 4 weeks or so.
I don't really like that outlook....
Considering xFShout would do much better in the long term, TaigaChat has been downloaded 250+ times as it is right now. The Avatar and Sig mods could be good features to have, but I think overall, you could have gained a better view with the sales from xFShout. Currently, I have seen 20 different replies about getting shoutbox commands in the other shoutbox, and it isn't happening. There is not control on editing shouts, pruning, PMing, nothing....
I have heavily modified the original xfShout code to get it to look halfway like we would want it, the only thing I am stuck on is a BBCode Toolbar...
That is what is done so far.... I just really think you guys would get a better view of what could be done, using one of your most popular products....
We deliberately picked our latest two vBulletin mods so we could closely compare the sales rates between the two.
The decision won't be based on total numbers, it'd be based on comparing the ROI of the xF version versus the vB version in terms of how much extra time it takes to port to xF vs how much money it makes.
Porting such an old and well established vB mod would have made an accurate comparison more or less impossible.
As you say the avatars/signature mod won't be as popular as something like a shoutbox, but that still holds true for vBulletin as well, so it should more or less even itself out.
Don't worry, we're not amateurs.
Cosmic
Not sure what you mean with the last comment, but anywho....
With the base that you have for xFShout 1.0, it seems strange that it is being left behind for the time, all things considering. The version uploaded to xF is very good, and many people want to use it, if there were just a couple lines of code removed or changed.
Fetching Shouts in ......
The main reason people stopped d/loading xFShout was because support was dropped, that is the only reason. You have a great customer base here, many who have your vB products ( I purchased quite a few for vB myself) already, and have a xF license they want to use as well....
My post certainly wasn't downplaying if you were an amateur or not, nor any disrespect to the coders or members who worked on the add-ons. Just simply trying to understand the decision to go ahead with those, instead of working on one you already have a great start on for a Lite version.... That was it. I won't ask again, my apologies.
We deliberately picked our latest two vBulletin mods so we could closely compare the sales rates between the two.
The decision won't be based on total numbers, it'd be based on comparing the ROI of the xF version versus the vB version in terms of how much extra time it takes to port to xF vs how much money it makes.
Porting such an old and well established vB mod would have made an accurate comparison more or less impossible.
As you say the avatars/signature mod won't be as popular as something like a shoutbox, but that still holds true for vBulletin as well, so it should more or less even itself out.
Don't worry, we're not amateurs.
Cosmic
Well, I removed the first line, through a template edit. But can't remove the second line. Do you know which CSS rule it is? Oh and do you like how I customized xFShout? Also, how to get the shout time to display like this;
example 6:45
I don't want it like this; 1 moment ago
$shout['dateline_parsed'] = XenForo_Locale::[COLOR="#FF0000"]dateTime[/COLOR]($shout['dateline'], '[COLOR="#FF0000"]relative[/COLOR]');
$shout['dateline_parsed'] = XenForo_Locale::[COLOR="#FF0000"]time[/COLOR]($shout['dateline'], '[COLOR="#FF0000"]absolute[/COLOR]');
We use essential cookies to make this site work, and optional cookies to enhance your experience.