SimplePortal

Customization => Custom Coding => Topic started by: SimianSteam on June 03, 2014, 10:44:58 AM

Title: SP ShoutBox Android App?
Post by: SimianSteam on June 03, 2014, 10:44:58 AM
I'm wondering if this is even possible, though it should be. A simple Android app that links to the forum's shoutbox. All it needs to show is the Shoutbox and a login button.

Thoughts?
Title: Re: SP ShoutBox Android App?
Post by: velorooms on June 18, 2014, 11:01:52 AM
it is possible. ive been working on something, but put it on hold for a while.

basically it was coded as php pages, a login page, and then the shoutbox page once logged in, and then just packaged the pages as an android web app.

but its a long way from being complete
Title: Re: SP ShoutBox Android App?
Post by: parsnipnose3000 on July 11, 2014, 11:51:37 PM
I've been looking for exactly the same thing, too.   :nervous-happy:
Title: Re: SP ShoutBox Android App?
Post by: SimianSteam on July 26, 2014, 11:37:21 AM
I've got no experience with the coding involved so wouldn't be able to actually do it, but shouldn't it be possible to set up a custom page in SMF/SP that has a custom theme and embed the shoutbox in it with php? I'm thinking the theme would be super-simple, just a small header with site logo and sign in box and the ShoutBox would take up the rest of the body. I know you can package HTML pages as apps, and it seems that someone with the coding knowledge could toss this together pretty easily.
Title: Re: SP ShoutBox Android App?
Post by: [SiNaN] on July 26, 2014, 01:09:52 PM
Coding a dedicated Anroid app would be time consuming and I'm not very convinced that it's worth it. However, I could help you with your final request. You can use the following code to have a shoutbox only page:

Code: [Select]
<?php

$shoutbox_id 
1;
$ssi_layers = array('html');

require(
'SSI.php');

echo 
'
<div class="windowbg" style="padding: 1em; overflow: auto; margin: 1em;">
'
sp_shoutbox(array('shoutbox' => $shoutbox_id), 0), '
</div>'
;

Change 1 as the id of the shoutbox you want to embed. You may have to include the path to SSI.php on line 6 if you want to use this outside of forum root directory - otherwise it should just work fine.
Title: Re: SP ShoutBox Android App?
Post by: SimianSteam on July 27, 2014, 09:59:56 AM
Coding a dedicated Anroid app would be time consuming and I'm not very convinced that it's worth it. However, I could help you with your final request. You can use the following code to have a shoutbox only page:

Code: [Select]
<?php

$shoutbox_id 
1;
$ssi_layers = array('html');

require(
'SSI.php');

echo 
'
<div class="windowbg" style="padding: 1em; overflow: auto; margin: 1em;">
'
sp_shoutbox(array('shoutbox' => $shoutbox_id), 0), '
</div>'
;

Change 1 as the id of the shoutbox you want to embed. You may have to include the path to SSI.php on line 6 if you want to use this outside of forum root directory - otherwise it should just work fine.

Thank you! That's part of it, but what I'm trying to get at is a way around coding a dedicated Android app.

Is there a way to make a custom forum page, with SP or otherwise, and force it to use a theme other than the default?
Title: Re: SP ShoutBox Android App?
Post by: [SiNaN] on July 27, 2014, 10:06:07 AM
In the code I gave above:

Code: (Find) [Select]
$ssi_layers = array('html');
Code: (Replace) [Select]
$ssi_theme = 123;
$ssi_layers = array('html');

Change 123 as the id of the theme that you want to use on that page.
Title: Re: SP ShoutBox Android App?
Post by: SimianSteam on July 27, 2014, 10:10:46 AM
In the code I gave above:

Code: (Find) [Select]
$ssi_layers = array('html');
Code: (Replace) [Select]
$ssi_theme = 123;
$ssi_layers = array('html');

Change 123 as the id of the theme that you want to use on that page.

Excellent, Thank You! I'll get to work on stripping down Curve to it's bare bones and give all this a shot. I'll report back when I've got something functional.

Thank you again!

Edit: Getting a Database error when I try to implement that code. My forum's in a subdirectory called "forum", so I directed it to "../forum/SSI.php". I'm sure that's where the error is, but not sure how to fix it.
Title: Re: SP ShoutBox Android App?
Post by: [SiNaN] on July 27, 2014, 10:36:21 AM
Excellent, Thank You! I'll get to work on stripping down Curve to it's bare bones and give all this a shot. I'll report back when I've got something functional.

Just so you know, the code I gave above makes sure that header and footer of the theme is not displayed. So you probably won't need to strip much, if any.

Edit: Getting a Database error when I try to implement that code. My forum's in a subdirectory called "forum", so I directed it to "../forum/SSI.php". I'm sure that's where the error is, but not sure how to fix it.

I had tested the code myself and there weren't any errors. Can you provide more information regarding the error that you receive? What exactly is the error? Which table/field is it related to? You can probably see the details in the Forum Error Log and adding $db_show_debug = true; at the end of your Settings.php file should provide a lot more information.
Title: Re: SP ShoutBox Android App?
Post by: SimianSteam on July 27, 2014, 10:40:18 AM
Just so you know, the code I gave above makes sure that header and footer of the theme is not displayed. So you probably won't need to strip much, if any.

Sweet! I wonder if it'll run faster with a completely gutted theme, though?

Quote
I had tested the code myself and there weren't any errors. Can you provide more information regarding the error that you receive? What exactly is the error? Which table/field is it related to? You can probably see the details in the Forum Error Log and adding $db_show_debug = true; at the end of your Settings.php file should provide a lot more information.

The error occurs when I try to create the SimplePortal page:

Quote
An Error Has Occurred!
Database error in block code. Please check the code.

Here's the exact code I'm using:

Code: [Select]
<?php

$shoutbox_id 
1;
$ssi_layers = array('html');

require(
'../forum/SSI.php');

echo 
'
<div class="windowbg" style="padding: 1em; overflow: auto; margin: 1em;">
'
sp_shoutbox(array('shoutbox' => $shoutbox_id), 0), '
</div>'
;
Title: Re: SP ShoutBox Android App?
Post by: [SiNaN] on July 27, 2014, 12:09:08 PM
You aren't supposed to create a new page. Sorry if it wasn't clear. That code above is supposed to run standalone. I mean, you need to put that code in a separate file and upload that file to your server.

For example, download the attached file, edit $shoutbox_id variable as the id of the shoutbox you want to be displayed and $ssi_theme variable as the id of the theme that you want to be used. Then upload it to the root directory of your forum on your server. (the directory where you have your forum's index.php, Settings.php and SSI.php files) Then go to the following address with your browser: location.to/your/forum/shoutbox.php
Title: Re: SP ShoutBox Android App?
Post by: velorooms on April 26, 2015, 08:32:30 PM
This is very similar to what I got half finished.

We wanted a dedicated shoutbox app as he have live chats for our races.

As far as I got was

1) Login page using ssi etc
2) index page with links to the various chats
3) and then as you have done, the chats hosted seperately on individual pages
4) packaged it basically as a html app

Never quite got around to finish it though, mainly styling and a few other things, but its possible using the basics of what you have here, just needs logon method adding.

Coding a dedicated Anroid app would be time consuming and I'm not very convinced that it's worth it. However, I could help you with your final request. You can use the following code to have a shoutbox only page:

Code: [Select]
<?php

$shoutbox_id 
1;
$ssi_layers = array('html');

require(
'SSI.php');

echo 
'
<div class="windowbg" style="padding: 1em; overflow: auto; margin: 1em;">
'
sp_shoutbox(array('shoutbox' => $shoutbox_id), 0), '
</div>'
;

Change 1 as the id of the shoutbox you want to embed. You may have to include the path to SSI.php on line 6 if you want to use this outside of forum root directory - otherwise it should just work fine.
Title: Re: SP ShoutBox Android App?
Post by: velorooms on April 26, 2015, 08:36:37 PM
As far as I got

1) Login
Code: [Select]
<?php
require_once('SSI.php');

if (
$context['user']['is_guest'])
{
ssi_login();
}
else
{
ssi_logout();  
}

$_SESSION['login_url'] = 'http://velorooms.com/minichatmenu.html';
$_SESSION['logout_url'] = 'http://velorooms.com/minichatmenu.html';
?>

which takes you to minichatmenu.html

but that ended up being redone and just being a basic php page

Code: [Select]
<?php

  
echo '<a href="/index.php/page,Livechat1.html">Livechat1</a>.';
  echo 
'<a href="/index.php/page,Livechat2.html">Livechat2</a>.';
    echo 
'<a href="/index.php/page,Livechat3.html">Livechat3</a>.';
  echo '<a href="/index.php/page,Livechat4.html">Livechat4</a>.';
    echo '<a href="/index.php/page,Livechat5.html">Livechat5</a>.';
 
?>

but then in turn i reverted those to php

Code: [Select]
<?php
require_once('SSI.php');
echo 
'
<link rel="stylesheet" href="http://velorooms.com/Themes/default/css/minichat.css" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Oswald:700,400,300|Signika:700,400,300" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://velorooms.com/vr-js/jquery.min.js"></script>
<script type="text/javascript" src="http://velorooms.com/Themes/default/scripts/portal.js?234"></script>'
;

?>


<div class="buttonlist">
<ul>
<li><a class="home" href="../minichatmenu.php"><span class="last">Back</span></a></li></br>
</ul></div>

<?php

$params
['shoutbox'] = 4// Your shoutbox ID
sp_shoutbox($params0);


 
?>

I need to look back and see what i actually did :D
Title: Re: SP ShoutBox Android App?
Post by: ♦ Ninja ZX-10RR ♦ on April 26, 2015, 09:44:43 PM
In the meantime, unless you want to get hacked, I suggest you to update your SMF to 2.0.9/10 immediately. 2.0.5 is outdated and has many security holes.
Title: Re: SP ShoutBox Android App?
Post by: velorooms on April 27, 2015, 02:37:45 PM
In the meantime, unless you want to get hacked, I suggest you to update your SMF to 2.0.9/10 immediately. 2.0.5 is outdated and has many security holes.

im on about 2.0.8, all the edits are done manually so takes me a while to catch up. ;)
Title: Re: SP ShoutBox Android App?
Post by: ♦ Ninja ZX-10RR ♦ on April 27, 2015, 04:10:45 PM
Why would you *ever* want to do hundreds of edits manually? It's definitely not a wise choice.
Title: Re: SP ShoutBox Android App?
Post by: velorooms on April 27, 2015, 08:24:27 PM
Why would you *ever* want to do hundreds of edits manually? It's definitely not a wise choice.

Because you can get to a point with an smf installation when package parser looks at you and is like "you crazy fool, what you want me to do with that"

Our SMF is heavily modified, from simple things like link trees gone, to changes in the way it handles js, pngs throughout the site (so even something like .gif in parser kills it), huge swathes of redundant code removed, curve doesnt even exist, theme(s) is all hard coded

If i put anything through package parser it just laughs and shows loads of red. :D

And yes, coding themes independantly, and not doing vaste swathes of edits on core files is probably advisable (kids, do as I say not do as I do), but smf was so badly neglected until Arantor kicked everyones bums that we kinda went our own way on thing :D
Title: Re: SP ShoutBox Android App?
Post by: ♦ Ninja ZX-10RR ♦ on April 27, 2015, 08:31:53 PM
Well I am running over 135 mods and 4 custom themes based off the default one but I don't have such issues, that's why I was asking...
Title: Re: SP ShoutBox Android App?
Post by: velorooms on April 27, 2015, 08:56:53 PM
Well I am running over 135 mods and 4 custom themes based off the default one but I don't have such issues, that's why I was asking...

But do you still have curve installed as your default theme? We ripped out curve and hard coded the default. Because our main theme is so stripped down, we were having to make manual edits to both curve and our theme with every install, so we eventually ditched curve altogether and just coded the default theme ourselves.

even basic things like our subs.php file have been utterly vandalised :D





Title: Re: SP ShoutBox Android App?
Post by: Chen Zhen on April 27, 2015, 10:01:09 PM

My advice for people that wish to do extensive modifications to regular SMF files is to create an installer package(s) that perform the edits.
This way one can always redo their forum with a full upgrade at any point in time & then just install their custom package(s).
As for a personalized custom theme one can also create their own theme installer.

During the process you simply test your edits and when satisfied apply them to your installer as search->add/replace.
Title: Re: SP ShoutBox Android App?
Post by: ♦ Ninja ZX-10RR ♦ on April 27, 2015, 11:43:39 PM
Thank you for clearing it, just wanted to first make sure that your security wasn't affected before attempting any edits/applications :)

Chen Zhen I got a basically default forum that I mess with, before actually editing stuff on the live one ;)
SimplePortal 2.3.8 © 2008-2024, SimplePortal