Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: live627 on April 29, 2008, 07:45:20 PM

Title: Site Integration Mod
Post by: live627 on April 29, 2008, 07:45:20 PM
[Link to the mod](https://custom.simplemachines.org/index.php?mod=1146)

## Site Integration Mod
[![MIT license](http://img.shields.io/badge/license-MIT-009999.svg)](http://opensource.org/licenses/MIT)
[![GitHub issues](https://img.shields.io/github/issues/live627/smf-site-integration.svg)](https://github.com/live627/smf-site-integration/issues)
[![Latest Version](https://img.shields.io/github/release/live627/smf-site-integration.svg)](https://github.com/live627/smf-site-integration/releases) [![Support](http://img.shields.io/badge/PayPal-$-009966.svg)](https://www.paypal.me/JohnRayes)

Package name | SMF version | Minimmum PHP version
--- | --- | ---
Site Integration Mod 2.0.0 | SMF 2.0.x | PHP 7.0
Site Integration Mod 1.4.1 | SMF 1.1.x, 2.0.x | PHP 4.3 – PHP 5.4

[View changelog](https://github.com/live627/smf-site-integration/blob/master/CHANGELOG.md)

### Overview
The Mod works by looking in a series of specific folders (defined by the admin) for `.php` files to include as actions, each included file will then be accessable within SMF from `index.php?action=(filename without trailing `.php`).
- Create custom pages for your forum that may be accessed via direct link (`smf.example.com/index.php?action=demo`)
- Select membergroups that can access the actions
- Choose an action to use as a landing page instead of the board index
- Choose an action for errors (invalid or missing actions) instead of the board index
  - Does not change the standard error for missing or hidden topics
- Elect whether or not to show the action's name in Who's Online

This mod was borne of a desire for an easier way to integrate small php scripts and HTML pages into SMF without using the normal [SSI.php functions](http://docs.simplemachines.org/index.php?topic=400).

### Features Explained:
Settings are found in the admin panel: "Configuration" dropdown menu -> 'Modifications' -> 'Site Integration' Tab.

*   **Forum Default/Home Action:** This allows you to change the home page of your forums. Please note that your Board Index will still be accessible (`index.php?action=forum`). If you leave the setting blank then your normal Board Index will be your home page/action.
*   **Invalid Action Error Action:** This allows you to show a specific action every time an invalid action is passed by the user. If you don't set this then it will just show the home/default page.
*   **Site-Wide Language Integration Files:** (_only important if you are using more than one language_) Comma-seperated list of directories to search for language files in the form of `(current action).(current language).php`. These files will then be included before your included file/action, so that you can use a language system similar to the SMF language system where you define the same text variable (`$txt['welcome'] = 'Welcome to my Website!';`) in multiple language files and then access it later (eg `echo $txt['welcome'];`).

Further explanation of feature functionality can be found by clicking on the [?] help button next to each setting.

### Important Information

This Mod should work for all installed themes. However, if you wish to customize the default layout, you can edit the `template_SiteIntegration()` function in the `SiteIntegration.template.php` template file. Hint: copy this file to another theme to   have a unique layout for that theme.

You have to set the permissions for all the includes actions/files that you want normal users or guests to see, by default every included action/file can only be seen by the admin of your website.

You can access any of the global variables from SMF, just like a mod. An example of declaring globals (this is easily forgotten):
```php
global $var;
```
Or for multiples:
```php
global $var1, $var2, $var3, ..., $varN;
```
You can use any of the functions which are defined by SMF from within the PHP code on your pages. Remember to `include` the       files first! (Refer to the [Function Database](https://wiki.simplemachines.org/smf/Function_database))

The index pages from your folders will _**never**_ be turned into actions. I would suggest that you copy an index.php page from one of the other SMF folders to protect your folders, so that people can't see a list of your files.

Finally note that you should always include the code below in all of your '.php ' files, so that if users try to view those files they will be redirected to the file's smf action. You only need to change the value of $smfurl to the web address of your SMF's index.php for it to work, ie. (`http://www.smf.example.com/index.php`).
```php
$smfurl = '{web adress of your SMFs index.php}';
if (!defined('SMF'))
   header('Location: ' . $smfurl . '?action=' . strtok(basename($_SERVER['SCRIPT_FILENAME']), '.');
```
### Tutorial
**[View more tutorials](https://github.com/live627/smf-site-integration/tree/main/docs)**
#### Create a simple action
1. Create directory `file_includes` in SMF root (`$boarddir`)
2. Create file in said directory `demo.php`
3. Save the following code to it
   ```php
   <?php

   echo 'Hello world';
   ```
4. Navigate browser to Administration Center » Configuration » Modifications » Site Integration
   1. Click "Manage" for settings specific to the `demo` action
      - _"File/Action Include Folders" MUST include `file_includes` or no files will be found_
   2. Enter the name and choose the group permisisons, click "Save"
   3. Click "demo" in the management table to view the action
      - The address bar should show `smf.example.com/index.php?action=demo`

#### Adding menu buttons for your actions
Download [Ultimate Menu](https://custom.simplemachines.org/index.php?mod=3674) for your menu building needs
Title: Re: Site integration Mod
Post by: Apllicmz on April 30, 2008, 02:00:31 AM
did have demo...

translate Portuguese

help

<file name="$themedir/languages/Help.portuguese-utf8.php" error="skip">
<operation error="skip">
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configura&#231;&#227;o permite a voc&#234; adicionar v&#225;rias pastas, por que os separam por v&#237;rgulas. Todas as situa&#231;&#245;es. Php esses arquivos em pastas ser&#227;o convertidas em ac&#231;&#245;es atrav&#233;s da SMF.<br/><br/>Observe que a pasta nomes s&#227;o relativos &#224; SMF diret&#243;rio home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note tamb&#233;m que n&#227;o importa se voc&#234; usar barras no in&#237;cio ou no fim da pasta nomes, eles est&#227;o no meio nessesario por&#233;m se voc&#234; estiver tentando carregar uma sub-pasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Help.brazilian-utf8.php" error="skip">
<operation error="skip">
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configura&#231;&#227;o permite a voc&#234; adicionar v&#225;rias pastas, por que os separam por v&#237;rgulas. Todas as situa&#231;&#245;es. Php esses arquivos em pastas ser&#227;o convertidas em ac&#231;&#245;es atrav&#233;s da SMF.<br/><br/>Observe que a pasta nomes s&#227;o relativos &#224; SMF diret&#243;rio home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note tamb&#233;m que n&#227;o importa se voc&#234; usar barras no in&#237;cio ou no fim da pasta nomes, eles est&#227;o no meio nessesario por&#233;m se voc&#234; estiver tentando carregar uma sub-pasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>




Help not utf8

<file name="$themedir/languages/Help.portuguese.php" error="skip">
<operation>
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configuração permite a você adicionar várias pastas, por que os separam por vírgulas. Todas as situações. Php esses arquivos em pastas serão convertidas em acções através da SMF.<br/><br/>Observe que a pasta nomes são relativos à SMF diretório home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note também que não importa se você usar barras no início ou no fim da pasta nomes, eles estão no meio nessesary porém se você estiver tentando carregar uma subpasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Help.brazilian.php" error="skip">
<operation>
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'Esta configuração permite a você adicionar várias pastas, por que os separam por vírgulas. Todas as situações. Php esses arquivos em pastas serão convertidas em acções através da SMF.<br/><br/>Observe que a pasta nomes são relativos à SMF diretório home. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br/><br/>Note também que não importa se você usar barras no início ou no fim da pasta nomes, eles estão no meio nessesary porém se você estiver tentando carregar uma subpasta (eg. \'file_includes/files\').';

]]></add>
</operation>
</file>



modification

<file name="$themedir/languages/Modifications.portuguese-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'P&#225;ginas em Geral integra&#231;&#227;o configura&#231;&#245;es';
$txt['integrationmod_tab_heading'] = 'P&#225;gina Integra&#231;&#227;o';
$txt['integrationmod_site_includes_folders'] = 'Arquivo / ac&#231;&#227;o incluem pastas:';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.brazilian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'P&#225;ginas em Geral integra&#231;&#227;o configura&#231;&#245;es';
$txt['integrationmod_tab_heading'] = 'P&#225;gina Integra&#231;&#227;o';
$txt['integrationmod_site_includes_folders'] = 'Arquivo / ac&#231;&#227;o incluem pastas:';

]]></add>
</operation>
</file>
Title: Re: Site integration Mod
Post by: Nathaniel on April 30, 2008, 05:27:52 PM
Thank you for translating it, :)

I will add aditional translations when I do another version.

Any comments or suggestions?
Title: Re: Site integration Mod
Post by: _Anthony_ on April 30, 2008, 07:13:32 PM
I do not understand.
Please tell me how this modification works.
And if they wanted to integrate the site with the forums could they not just use the functions in SSI.php?
Title: Re: Site integration Mod
Post by: Eliana Tamerin on May 01, 2008, 12:56:18 AM
Wow, how did I manage to miss this?

/me bugs the customization team to sort by approval date instead of submission date again.

Sounds like a great concept. I look forward to seeing some people integrate their normal HTML sites with SMF without having to know loads of php.
Title: Re: Site integration Mod
Post by: Nathaniel on May 01, 2008, 12:57:31 AM
Quote from: MrMoney on April 30, 2008, 07:13:32 PM
I do not understand.
Please tell me how this modification works.

I am sorry if my explanation is a little bit complicated, I will try to work on it.

This Mod creates a setting in the "features and settings" ("modifications" for smf 2 beta) part of the admin section, which allows you to make a list of folders. Every '.php' file from each of these folders will be added as an action into the SMF system, allowing for easier integration. To access the action for a particular file you type in "index.php?action=(filename without the trailing '.php')".

Quote from: MrMoney on April 30, 2008, 07:13:32 PM
And if they wanted to integrate the site with the forums could they not just use the functions in SSI.php?

Yes, this Mod performs a similar task to the SSI.php functions, except that it is much easier to setup and means that people don't have to worry about calling certain functions or learning how to use the functions. It also means that your entire site looks fully integrated with SMF because it uses the SMF action system, ie index.php?action=(filename without the trailing '.php').

This Mod was also going to originally have a Custom Menu system, which would have included custom permissions for actions, but I have spilt that into another Mod which I should complete in a week or two.

As I have already said, I am planning to put in some more usefull integration settings, such as login/logout redirect actions and etc. Any suggestions as to useful features for integration that you think this Mod could have would be most welcome.

The general idea of this Mod is that its easy to use, much easier than the SSI.php method.

Thank you for your comments.
:)

Title: Re: Site integration Mod
Post by: Apllicmz on May 01, 2008, 01:41:46 AM
You can do a demo and that which are pages which supports .. because I am using joomla and possibly
Title: Re: Site integration Mod
Post by: _Anthony_ on May 01, 2008, 02:13:50 AM
Oh i get it now very nice
Title: Re: Site integration Mod
Post by: Nathaniel on May 01, 2008, 03:57:47 AM
Demo is located at www.verbtest.com (http://www.verbtest.com/index.php?action=demo)

All I had to do to setup the demo, was to install the Mod, upload some files to the /demo folder, and then type 'demo' for the folder includes setting.

Easy!  ;)
Title: Re: Site integration Mod
Post by: Apllicmz on May 01, 2008, 04:05:47 AM
It works so with version 2.0
Title: Re: Site integration Mod
Post by: Nathaniel on May 01, 2008, 05:12:48 AM
* Updated

v1.13. Changes:
Added Portugues and Brazilian thanks to joomlamz.
Updated the Mod to work with SMF 1.1.5.

It will still works perfectly with SMF 1.1.4,

I have made a SMF 1.1.5 demo at http://www.verbtest.com/smfdemo/ (http://www.verbtest.com/smfdemo/index.php?action=demo)

joomlamz, you didn't post any non-utf8 "language.modifications.php" translation so I just copied the utf-8 ones, could you please post back if this is a problem.

Thank you,
LHVWB
Title: Re: Site integration Mod
Post by: damnitmike on May 01, 2008, 10:35:26 AM
This mod has me interested....but when I go to the demo, all I see is a page of code....

It looks like it is trying to show a file, but permissions don't allow it???

Do you need to be logged in to see it???

I'll keep watching this mod......it looks like it has some nice possibilities.

Title: Re: Site integration Mod
Post by: Apllicmz on May 01, 2008, 01:10:07 PM
thank You Update Now

<file name="$themedir/languages/Modifications.portuguese.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'Paginas em Geral integração configurações';
$txt['integrationmod_site_includes_folders'] = 'Ficheiro/acção incluem pastas:';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[

// Site Integration Text.
$txt['integrationmod_generalsettings_heading'] = 'Paginas em Geral integração configurações';
$txt['integrationmod_site_includes_folders'] = 'Ficheiro/acção incluem pastas:';

]]></add>
</operation>
</file>
Title: Re: Site integration Mod
Post by: Nathaniel on May 05, 2008, 11:08:21 PM
Changes:
I have improved the clarity of my explanations about the Mod on the Mod page. I have also update the Mod to version 1.2 which includes the language include options that allow the actions/files to have multi-language support much more easily. Below is an example of how this could work.

Example website settings.
File/Action Include Folders:  'action_includes'
Language File Include Folders: 'language_includes'
Site-Wide Language Integration Files: 'site_language_support'

I have two files in the 'action_includes' folder:
"demo.php"

<?php
echo($general_text);
echo(
$demo_text);
?>


"demo2.php"

<?php
echo($general_text);
echo(
$demo_text);
?>


I have six files in the 'language_includes' folder:

"demo.english.php".

<?php
$demo_text
= "English Demo1 text.";
?>


"demo.french-utf8.php".

<?php
$demo_text
= "French Demo1 text.";
?>


"demo2.english.php".

<?php
$demo_text
= "English Demo2 text.";
?>


"demo2.french-utf8.php".

<?php
$demo_text
= "French Demo2 text.";
?>


"site_language_support.english.php".

<?php
$general_text
= "English General Site Language Support text.";
?>


"site_language_support.french-utf8.php".

<?php
$general_text
= "French General Site Language Support text.";
?>


When I load the actions with the english language these are the outputs:

"index.php?action=demo"
Quote
English General Site Language Support text.
English Demo1 text.

"index.php?action=demo2"
Quote
English General Site Language Support text.
English Demo2 text.

When I load the actions with the french-utf8 language these are the outputs:

"index.php?action=demo"
Quote
French General Site Language Support text.
French Demo1 text.

"index.php?action=demo2"
Quote
French General Site Language Support text.
French Demo2 text.


Title: Re: Site integration Mod
Post by: Nathaniel on May 05, 2008, 11:16:19 PM
Sorry joomlamz, because I have added more text to the Mod there is more to translate. If anyone wants to add any translations to the mod then the langauge strings are below.

<file name="$themedir/languages/Modifications.english.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[

// Site Integration Mod Text.
$txt['integrationmod_generalsettings_heading'] = 'General Site Integration Settings';
$txt['integrationmod_tab_heading'] = 'Site Integration';
$txt['integrationmod_site_includes_folders'] = 'File/Action Include Folders:';
$txt['integrationmod_site_language_includes_folders'] = 'Language File Include Folders:';
$txt['integrationmod_site_general_language_files'] = 'Site-Wide Language Integration Files:';

]]></add>
</operation>
</file>
<file name="$themedir/languages/Help.english.php" error="skip">
<operation error="skip">
<search position="before"><![CDATA[
$helptxt = array();
]]></search>
<add><![CDATA[

// Help for the Site Integration Mod
$helptxt['integrationmod_site_includes_folders'] = 'This settings allows you to add multiple folders, by separating them with commas. All of the .php files in those folders will be turned into actions by SMF.<br/><br/>Please Note that the folder names are relative to the SMF home directory. (eg. \'file_includes\' will load actions from \'(SMF Home Directory)/file_includes/\')<br /><br />Also Note that it doesn\'t matter if you use forward slashes at the beginning or end of the folder names, they are however nessesary in the middle if you are trying to load a subfolder (eg. \'file_includes/files\').';
$helptxt['integrationmod_site_language_includes_folders'] = 'If your site only uses one language then ignore this option. <br /><br />This settting allows you to make a list of folders, separated by commas. When you view one of the actions/files loaded by this Mod using the previous setting, SMF will search through these folders for any language include files, in a way similar to the inbuilt SMF language system.<br /><br />First it will search for a specific language file for the current action (ie. "(current action).(User\'s current SMF language).php"). For example, when the action is \'demo\' and the langauge is \'english-utf8\' it will look for \'demo.english-utf8.php\'.<br /><br /> It will also search for any general site-wide language include files in these folders (refer to the next setting). <br /><br /> Within the actual language files themselves, you can declare string variables that you can then use in your action to make your actions have multiple language translations.';
$helptxt['integrationmod_site_general_language_files'] = 'If your site only uses one language then ignore this option. <br /><br />This setting allows you to add a series of general site-wide language includes, separated by commas. When the system searches through your language include folders (refer to above setting), it will always include language files which have this prefix, no matter which action you are viewing.<br /><br /> For example, when the language is french-utf8 and the action is demo, but you have set a general language include called \'sitelanguage\', it will look for and include \'demo.french-utf8.php\' and \'sitelanguage.french-utf8.php\'. <br /><br /> Setting variables and using them works exactly the same for these site-wide language includes, as for the language includes discussed in the previous settings help pop-up.';

]]></add>
</operation>
</file>


Quote from: damnitmike on May 01, 2008, 10:35:26 AM
This mod has me interested....but when I go to the demo, all I see is a page of code....

It looks like it is trying to show a file, but permissions don't allow it???

Do you need to be logged in to see it???

I'll keep watching this mod......it looks like it has some nice possibilities.


damnitmike,

I am not entirely sure what you are refering to. The page which is link as the demo is meant to show some code as example to show you how to protect your pages and etc.
Title: Re: Site integration Mod
Post by: Apllicmz on May 06, 2008, 12:42:51 AM
Thank you  now try o translate to see how she work...

try to see in attach Portuguese and brazilian.xml



Edit: Update Now Thank you
Title: Re: Site integration Mod
Post by: Nathaniel on May 06, 2008, 02:44:23 AM
Okay, thanks joomlamz.

I have updated the Mod with support for brazilian and portuguese. The edits in the brazilian.xml file that you sent me were editing the portuguese files, I changed them to brazilian. They are both in the additional_languages.xml file in my mod.

I don't have time to test it at the moment, I will probably test it with those languages in a few hours.

Thank you for the translations.

Edit: I did some testing and it appears that some of the translations are still in english. Could you please fix this and then re-post them?
Title: Re: Site integration Mod
Post by: Eclipse16V on May 06, 2008, 04:21:34 AM
How can Guests see any site?

When an Guest click on an page, hi must be log in.
Title: Re: Site integration Mod
Post by: Nathaniel on May 06, 2008, 04:25:50 AM
I can't completely understand what you are trying to say, but if you want to retrict user access to any of these mod pages then you can do it using the allowedTo() function.
Title: Re: Site integration Mod
Post by: Eclipse16V on May 06, 2008, 05:07:11 AM
Rear one, yes and as I installation? Where? What? I want to be able to see that guests certain sides and other sides only for user am visible. Thanks
Title: Re: Site integration Mod
Post by: Nathaniel on May 06, 2008, 07:26:31 AM
I just remembered that this isn't as easy to do as I thought, I will work on a new version of my Mod which allows you to create permissions settings for your actions, as I just realised that this would be a very good addition to the Mod, it might take me a little while though.
Title: Re: Site integration Mod
Post by: Father Time on May 06, 2008, 03:21:25 PM
I'm not sure if this is limited to me, but when I installed this mod it caused my forum to become non functional. Then when I uninstall the mod, even though it fixed the forum crash, it left fragments of itself everywhere, including the settings page in the admin panel (which at this point is non functional). There are about 20 alterations that you need to manually remove to completely remove this mod.

Personally, although it's concept is great, I think it needs some work to be called "safe".
Title: Re: Site integration Mod
Post by: Davy-D on May 06, 2008, 05:36:35 PM
Hi,

I get an error after installing the mod and trying to enter any directory to the "file/action include folders".

The error is: "Fatal error: Call to undefined function: scandir() in /homepages/10/d77508133/htdocs/forum/index.php on line 405"
Title: Re: Site integration Mod
Post by: Nathaniel on May 06, 2008, 06:00:27 PM
I will look into these problems.

Which versions of SMF are you people using?

Edit:
Okay I tested it on SMF 2 Beta 3.1 and SMF 1.1.5, both worked perfectly, I also checked it on my live site which has millions of other mods installed. No clashes.

Father Time,
Could you please post the version of SMF and php you are using, as well as the exact error message because I was unable to replicate them.

Davy-D,
I am unsure why this is happening, it has to be something to do with the php versions because scandir() isn't supported by php4, my mod does however create a function for this in the sub-compat file meaning that it should work.

I will try to look into the php version error but I can't find any others.


Title: Re: Site integration Mod
Post by: Nathaniel on May 06, 2008, 11:47:54 PM
If this is the error you were receiving then I have fixed it.

Warning: sort() expects parameter 1 to be array, boolean given in D:\Program Files\xampp\htdocs\index.php on line 67


It was an error due to something very stupid that I had done in the compatibility function for php4 which has now been corrected. Please try to redownload and reinstall the Mod. It should work this time. :)

If it doesn't the please post again because I am not sure if there are any other errors.
Title: Re: Site integration Mod
Post by: Nathaniel on May 07, 2008, 02:48:58 AM
To get the Mod to work with SMF 1.1.5 and PHP 4, you will have to remove line 61 from the main SMF index.php file, which is below.


if (@version_compare(PHP_VERSION, '4.2.3') != 1)


I have done a series of identical demo sites, to test and show that the mod will work with different versions:

SMF 1.1.5 with php4, Site Integration Mod and DropDown Language Drop Mod (http://stssite.awardspace.com/smftest/index.php)
SMF 2 Beta 3.1 with php4 and Site Integration Mod. (To check language changes you can make an account)
SMF 1.1.5 with php5, Site Integration Mod and DropDown Language Drop Mod. (http://www.verbtest.com/smfdemo/index.php?action=demo)
Title: Re: Site integration Mod
Post by: [unplugged] on May 07, 2008, 02:59:30 AM
Just wanted to say what a great mod this is! It's VERY easy to use!

To integrate it a bit more to a site (at least with the default theme -- but can easily be rewritten to work with any theme) I wrapped the whole thing in a nice page that includes the navlink, titlebars, and even tabs. Looks really good IMO. There are a few simple variables (my PHP is very limited) to set it all up. Then I made the already small SiteIntegration.template.php even smaller...lol. Anyway...

You can see the demo HERE (http://www.empireofthesun.net/forum/index.php?action=demo).

I would be more than happy to attach my (modest) files if anyone is interested. All comments welcomed.

And thanks again LHVWB for a mod that even I can use. :P
Title: Re: Site integration Mod
Post by: Nathaniel on May 07, 2008, 03:48:58 AM
Thank you SunKing, my general aim was to make a mod that is easier to use than the SSI.php method. ;)

I am currently also working on yet another new version which is going to allow some settings to be made for each action which is being included. Its very easy to add these settings in so I am wondering if anyone has any suggestions for it. My current thinking is that you will be able to create a custom title (displayed in browser tab/window) and some custom permissions for each included action/file.

This is where I will add the ability to restrict permissions based on the request by Eclipse16V.

Any more suggestions for useful additions here would be most welcome. :)

Thank you,
LHVWB.
Title: Re: Site integration Mod
Post by: [unplugged] on May 07, 2008, 04:15:28 AM
Well, for me and my rudimentary capabilities, it worked right out of the box.  :D

Is there/will there be a way to add sub-actions?
And, yes, permissions would be great too.
Title: Re: Site integration Mod
Post by: Nathaniel on May 07, 2008, 04:47:17 AM
Adding subactions sounds interesting, I'll have a think about how I could do that.

In the meantime, to add subactions to your actions you can add some code like this into your pages (sa = subaction).


<?php

if($_GET['sa'] == "demo2")
{
    echo(
$demotext);
}
elseif(
$_GET['sa'] == "demo1")
{
    echo(
$demo2text);
}
else
{
    echo(
"Welcome to this subactions home".);
}
?>


What I am thinking is that you would have a setting for each action/file include in the part of the settings area which I am currently creating, which would allow you to either make it a subaction of another action or keep it as an action. I will see how easily I can implement this...

Thanks for the suggestion, :)
LHVWB.
Title: Re: Site integration Mod
Post by: [unplugged] on May 07, 2008, 05:04:12 AM
Hey! The sub-actions work great! The possibilities are endless. The little rusty cogs in my head are beginning to move......
Title: Re: Site integration Mod
Post by: Father Time on May 07, 2008, 10:04:36 AM
My PHP version is 4.1, and my SMF version is 1.1.4. I recieved the same issues as this user did:

Quote from: Davy-D on May 06, 2008, 05:36:35 PM
Hi,

I get an error after installing the mod and trying to enter any directory to the "file/action include folders".

The error is: "Fatal error: Call to undefined function: scandir() in /homepages/10/d77508133/htdocs/forum/index.php on line 405"
Title: Re: Site integration Mod
Post by: Eliana Tamerin on May 07, 2008, 10:45:20 AM
That means the mod didn't install properly. Check to see that all the edits have been made correctly.
Title: Re: Site integration Mod
Post by: Nathaniel on May 07, 2008, 05:20:45 PM
This Mod doesn't seem to work properly for php4, I am working on fixing this properly but below is a quick-fix.

For SMF 1.1.5 or 1.1.4, PHP 4:

Replace (from index.php):
// Using an old version of PHP?
if (@version_compare(PHP_VERSION, '4.2.3') != 1)
require_once($sourcedir . '/Subs-Compat.php');


With:
// Using an old version of PHP?
if (@version_compare(PHP_VERSION, '5') == -1)
require_once($sourcedir . '/Subs-Compat.php');


That will make it work perfectly for PHP4.

I am hesistant to actually fix this problem using the Mod because it appears to be an SMF wide problem (http://www.simplemachines.org/community/index.php?topic=238044.new;topicseen#quickreply).

Title: Re: Site integration Mod
Post by: [unplugged] on May 10, 2008, 02:24:03 AM
I was wondering if it were possible to set up the mod with the option whether or not to show all the upper stuff (header, user info block, etc). The reason I ask is because I have a few pages that need to be displayed minus the upper portion. Maybe you could have it with a variable (0 = disable header area, 1 = display header area) or similiar.

So then I could add SOME_VARIABLE = 0 at the top of the file and it would disable the header area (or something along those lines).

Probably not the best explanation in the world.  ;D
Title: Re: Site integration Mod
Post by: Nathaniel on May 10, 2008, 04:40:27 AM
I will see what I can do, but it may be difficult because it will involve mucking around with template files, which is a pain because I will do it only for the main template which not many people use.

Anyway, attached are some screenshots of what the need version (v1.3) of the Mod will look like in SMF 2 Beta 3.1, at the moment I have almost finished it for the beta but it will take some time for me to port it back to SMF 1.1.5.

1st screenshot shows the general settings page. Note the new list section which will show all of the currently included files/actions.
2nd screenshot shows the manage page for a particular included action, allowing you to make settings which SMF will remember.

I should have this version out within a week, any other suggestions for settings that I could put in the action/file include management page (2nd screenshot), would be most welcome before then.

Thank you,
LHVWB

Title: Re: Site integration Mod
Post by: Nathaniel on May 10, 2008, 06:01:42 AM
Quote from: SunKing on May 10, 2008, 02:24:03 AM
I was wondering if it were possible to set up the mod with the option whether or not to show all the upper stuff (header, user info block, etc). The reason I ask is because I have a few pages that need to be displayed minus the upper portion. Maybe you could have it with a variable (0 = disable header area, 1 = display header area) or similiar.

So then I could add SOME_VARIABLE = 0 at the top of the file and it would disable the header area (or something along those lines).

Probably not the best explanation in the world.  ;D

Okay, I looked into doing this and it seems that it would be a fair bit of work to set up for any particular template. Because of this is isn't feasable to try to implement it.

Also it wouldn't work because the header template function is loaded before the file is included meaning that you wouldn't be able to effect it at all.
Title: Re: Site integration Mod
Post by: [unplugged] on May 10, 2008, 06:05:12 AM
Thank you very much for looking into it. I am looking forward to the new release too. Looks fantastic.
Title: Re: Site integration Mod
Post by: Nathaniel on May 10, 2008, 07:35:59 AM
Quote from: SunKing on May 10, 2008, 06:05:12 AM
Thank you very much for looking into it. I am looking forward to the new release too. Looks fantastic.

It looks good in SMF 2 Beta and it works really well, but porting it back to SMF 1.1.5 is really annoying. I am currently in the process of rewriting a whole lot of cool settings function for SMF 1.1.5 which are new to the beta.

These are the two main areas which I need to port back.
The permissions checkbox area, this is completely new to SMF 2 Beta, so I have to write my own set of functions for it.
The list of includes, the system which sets up this list is awesome in SMF 2 Beta but non-exsistant in SMF 1.1.5.

Title: Re: Site integration Mod
Post by: [unplugged] on May 10, 2008, 07:41:15 AM
I am running SMF 2.0 beta 3.1 so I am ready for it!  ;D
Title: Re: Site integration Mod
Post by: Jennahan on May 10, 2008, 12:09:28 PM
Why variables like $user_info['groups']['0'] doesn`t work?
Title: Re: Site integration Mod
Post by: Eliana Tamerin on May 10, 2008, 01:16:28 PM
Because it's supposed to be if ($user_info['groups'] == 0) {}.
Title: Re: Site integration Mod
Post by: Jennahan on May 10, 2008, 01:37:03 PM
I mean... When I was making site using SSI.php i could write if(in_array(5, $user_info['groups'])) and it worked well.

With this mod it doesn`t work. That was my point.
Title: Re: Site integration Mod
Post by: Jennahan on May 10, 2008, 03:43:16 PM
So any suggestion what I need to do to handle it?
Title: Re: Site integration Mod
Post by: Nathaniel on May 10, 2008, 07:28:11 PM
This will still work perfectly, but there is something that you have to do before you can use the variable. Because it is a global variable and the file is being included from a function, you need to use some code like this.


global $user_info;


In the next release I will declare a whole load of global variables at the beginning of the function which includes your files so that you don't have to do this, but in the meantime you have to global it.

I have made a change to the mod main page to make this very clear.

At the moment only the $context global variable is being used by the including function.

List of current SMF global variables that the function accesses.
$context
Title: Re: Site integration Mod
Post by: erlend_sh on May 12, 2008, 07:35:54 AM
At first I thought maybe this mod would let me easily add a customized top navigation to my forum, to make it really easy for me to keep a global menu for all my web-apps. However, it seems your in-progress "Custom Menu Mod" is the exact thing I was looking for. Sorry for bringing a slightly off-topic post in here, but I was just wondering: Is there a thread up already somewhere regarding your "Custom Menu Mod"? I would very much like to follow it's development, and test if for you if you'd like (I'm a very low-tech user).
Title: Re: Site integration Mod
Post by: Nathaniel on May 13, 2008, 02:19:16 AM
Quote from: Sadr on May 12, 2008, 07:35:54 AM
At first I thought maybe this mod would let me easily add a customized top navigation to my forum, to make it really easy for me to keep a global menu for all my web-apps. However, it seems your in-progress "Custom Menu Mod" is the exact thing I was looking for. Sorry for bringing a slightly off-topic post in here, but I was just wondering: Is there a thread up already somewhere regarding your "Custom Menu Mod"? I would very much like to follow it's development, and test if for you if you'd like (I'm a very low-tech user).

Yes this is one of the things that I am keeping in Mind. The Site Integration Mod is only so useful without the ability to actually change the Menu system.

My current plan is to finish the next version of the Site Integration Mod in the next few days and then continue with the Custom Menu Mod, which I should have completed for SMF 2 Beta sometime across the next few weeks. I have already done most of the work for the Custom Menu Mod, I just stopped working on it to finish this Mod.

I have exams starting in a few weeks so the Custom Menu Mod may end up waiting for the completion of those in about 5 weeks.

I will post back here with any updates on that Mod.

Edit: One thing that I am wondering.

The Custom Menu Mod will allow you to customize the menu and create your own submenus, because of this is will have options about where it should put the normal forum buttons, either in the mainmenu, a submenu or in places of your chosing (ie. it won't add it anywhere).

I am wondering what you actually want to do. Do you just want to add a few buttons to the normal SMF menu? Or do you want to be able to create a submenu for each mainmenu button so that you separate your website into sections each with a different mainmenu button and submenu?
Title: Re: Site integration Mod
Post by: erlend_sh on May 13, 2008, 02:56:51 PM
Quote from: LHVWB on May 13, 2008, 02:19:16 AM(...) I am wondering what you actually want to do. Do you just want to add a few buttons to the normal SMF menu? Or do you want to be able to create a submenu for each mainmenu button so that you separate your website into sections each with a different mainmenu button and submenu?
What I want to do might require so much self-editing that there's really nothing a mod can do about it. What I have in mind is exactly what you see here on this board (or as in another example here (http://forum.projectfork.net/)); the standard forum menu, and above it, over the banner, a global menu for use on the entire webpage, not just the forum alone.

I guess I imagined that maybe your mod could make this procedure easier somehow, like being able to add a banner, then add the navigationbars of your choice either on top of or right under the top-banner. But that might be asking a lot. Seeing now what you actually had planned for this mod, I do see other ways that it could be og great use to me though.
Title: Re: Site integration Mod
Post by: Nathaniel on May 13, 2008, 07:44:06 PM
What you want to do would be entirely possible with the Mod that I am going to create, it would just mean that you would have to do some editing of your favorite theme, which is going to have to happen for anyone that wants to use the Mod and doesn't want to use the default theme.

When I finish the Mod I will make simple instructions, explaing how you can use the output of the system with a theme that hasn't been edited for the Mod before.
Title: Re: Site integration Mod
Post by: Nathaniel on May 14, 2008, 12:14:44 AM
Okay, I have now finished making the new version of the Mod and it works for both SMF 1.1.5 and SMF 2 Beta, I will upload it later after some testing.

So that this mod will work for SMF 1.1.4 or SMF 1.1.5 you need to have the Extra Settings Framework Mod installed, but as this Mod is yet to be accepted I have attached it to this post.

* The Attachment has been removed by LHVWB for licensing reasons *
Title: Re: Site integration Mod
Post by: erlend_sh on May 14, 2008, 09:09:49 AM
Quote from: LHVWB on May 13, 2008, 07:44:06 PM
What you want to do would be entirely possible with the Mod that I am going to create, it would just mean that you would have to do some editing of your favorite theme, which is going to have to happen for anyone that wants to use the Mod and doesn't want to use the default theme.
Would this be the kind of edits that the package installer could handle for you? I've got about 5 mods already that needed edits on custom themes, but I still didn't have to do a thing myself because the package installer took care of it as long as I told it to install the mod on the custom themes as well. My love for SMF 2.0 grows stronger with every admin-action  :-*
Title: Re: Site integration Mod
Post by: Nathaniel on May 14, 2008, 05:23:20 PM
Quote from: Sadr on May 14, 2008, 09:09:49 AM
Quote from: LHVWB on May 13, 2008, 07:44:06 PM
What you want to do would be entirely possible with the Mod that I am going to create, it would just mean that you would have to do some editing of your favorite theme, which is going to have to happen for anyone that wants to use the Mod and doesn't want to use the default theme.
Would this be the kind of edits that the package installer could handle for you? I've got about 5 mods already that needed edits on custom themes, but I still didn't have to do a thing myself because the package installer took care of it as long as I told it to install the mod on the custom themes as well. My love for SMF 2.0 grows stronger with every admin-action  :-*

No unfortunately probably not, there is a possibility that this could work for SMF 2 Beta with the limited number of Mods, but unfortunately most of the time (especially for SMF 1.1.5) it will involve manually editing the specific template file, I will however give detailed instructions. This will happen especially for SMF 1.1.5 because I will be porting back the new dynamic showing of the template which occurs in SMF 2 Beta, which is likely to create a range of errors for every template but I will try and make my explanation clear enough... :)

Title: Re: Site integration Mod
Post by: Nathaniel on May 15, 2008, 04:44:27 AM
Okay, I have finally  completed the lastest version of this Mod.

WARNING: If you are using SMF 1.1.5 you will need the ExtraSettingsFramework Mod for this Mod to work, as I have added a few settings which require this Mod to be installed. If you don't have this Mod then you will get fatal errors when you try to manage the settings. The ExtraSettingsFramework Mod is currently not approved but I have attached it to this thread (http://www.simplemachines.org/community/index.php?topic=236625.msg1542869#msg1542869).

Updating your version of the Mod involves, uninstalling it and then re-installing the lastest version, you will not lose any data.

Here are the changes:

v1.3
Added permissions and title management of included files/actions.
Fixed up all errors which were occuring with PHP4.
Removed semi-completed language translations.
Title: Re: Site integration Mod
Post by: [unplugged] on May 15, 2008, 10:29:54 AM
Thanks! However, there was a small problem uninstalling 1.2 (dealing with the ManageSettings.php) where it didn't remove everything. The installation was fine for 1.3 but I had to input all of the settings again (no big deal). The old settings are still there under the Modifications Section (original location) except the text strings are missing. Don't misunderstand, this is a fantastic mod.  :D I just wanted to post my findings so that these small issues can be resolved making it an even better mod! Also, you may want to put a brief description next to each setting of exactly what it does.

Thanks again for a great mod.

[EDIT]:

Anyone else with the same problem can simply uninstall the old version, then
open ManageSettings.php (in the Sources dir)
find the following:
// Site Integration Mod Settings.
'',
'<u>'.$txt['integrationmod_generalsettings_heading'].':</u>',
array('text', 'integrationmod_site_includes_folders'),
'',

and simply remove it. You can then install version 1.3.

Title: Re: Site integration Mod
Post by: [unplugged] on May 15, 2008, 10:56:51 AM
Another small request.  ;D

Could you add a link in the Manage screen to delete each file? This would just make it quite convenient.
Title: Re: Site integration Mod
Post by: Nathaniel on May 15, 2008, 05:30:38 PM
Quote from: SunKing on May 15, 2008, 10:29:54 AM
Thanks! However, there was a small problem uninstalling 1.2 (dealing with the ManageSettings.php) where it didn't remove everything. The installation was fine for 1.3 but I had to input all of the settings again (no big deal). The old settings are still there under the Modifications Section (original location) except the text strings are missing. Don't misunderstand, this is a fantastic mod.  :D I just wanted to post my findings so that these small issues can be resolved making it an even better mod! Also, you may want to put a brief description next to each setting of exactly what it does.

Thanks again for a great mod.

[EDIT]:

Anyone else with the same problem can simply uninstall the old version, then
open ManageSettings.php (in the Sources dir)
find the following:
// Site Integration Mod Settings.
'',
'<u>'.$txt['integrationmod_generalsettings_heading'].':</u>',
array('text', 'integrationmod_site_includes_folders'),
'',

and simply remove it. You can then install version 1.3.



I was unaware of this issue, I will investigate it when I have some time this weekend. I did however just remember that there is a problem with data loss between the versions even though I said there wasn't because I renamed the settings... ;) I will try to make a script which will fix this, as an edition to the mod which will search for the old variables and then rename them. Should be easy to do! :)

Thank you,


Quote from: SunKing on May 15, 2008, 10:56:51 AM
Another small request.  ;D

Could you add a link in the Manage screen to delete each file? This would just make it quite convenient.

That would probably be very simple to do, so I will think about making a new version with some sort of renaming/deleting capabilities for these files. If I find the time then I might even try to make it into a peusdo file manager. ;)

Any other suggestions or comments would be most welcome.

Title: Re: Site integration Mod
Post by: [unplugged] on May 15, 2008, 07:20:30 PM
Thanks so much. I'm not usually the type to bother with small request, if any at all...lol...but I really see a lot of potential with this one.
Title: Re: Site integration Mod
Post by: Sakae on May 15, 2008, 11:46:28 PM
Hi, I installed the last version in my SMF 1.1.5, but got this error when tried to access action=featuresettings;sa=siteintegration:

QuoteFatal error: require_once() [function.require]: Failed opening required '/home/xxxxx/public_html/forum/Sources/Subs-List.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxx/public_html/forum/Sources/ModSettings.php on line 755
Title: Re: Site integration Mod
Post by: [unplugged] on May 16, 2008, 12:09:01 AM
Quote from: LHVWB on May 15, 2008, 04:44:27 AM
WARNING: If you are using SMF 1.1.5 you will need the ExtraSettingsFramework Mod for this Mod to work, as I have added a few settings which require this Mod to be installed. If you don't have this Mod then you will get fatal errors when you try to manage the settings. The ExtraSettingsFramework Mod is currently not approved but I have attached it to this thread (http://www.simplemachines.org/community/index.php?topic=236625.msg1542869#msg1542869).

Updating your version of the Mod involves, uninstalling it and then re-installing the lastest version.

Did you make sure to also install the other required mod (found here (http://www.simplemachines.org/community/index.php?action=dlattach;topic=236625.0;attach=55889))?
It's required to run the Site Integration Mod on SMF 1.1.5.
Title: Re: Site integration Mod
Post by: Nathaniel on May 16, 2008, 04:03:36 AM
Okay just a quick update.

I have fixed the issue with the upgrading from version 1.2 to version 1.3. Installing the new version will automatically keep the database settings from the old version.

Also, In response to SunKing's question about adding some deleting functionality, I have decided that this is not crucial to the Mod, and that it can wait until after I have completed the CustomMenu Mod. I am hesitant to add a file manager or similar features because they will require a fair bit of work and the same functionality is usually provided by a ftp client or a file manager provided by your webhost. The general idea of this mod is that you make, name and control the files from outside of SMF, by using the tools that you would normally use to make a website.

In relation to the question about when I will finish the CustomMenu Mod, it is likely to be in about a 5 to 6 weeks, because I have a ton of exams and projects which I have to do in the next 4 weeks. I might make a simple Dev version before then but I will have to see.

Title: Re: Site integration Mod
Post by: Sakae on May 16, 2008, 12:32:02 PM
Quote from: SunKing on May 16, 2008, 12:09:01 AM
Did you make sure to also install the other required mod (found here (http://www.simplemachines.org/community/index.php?action=dlattach;topic=236625.0;attach=55889))?
It's required to run the Site Integration Mod on SMF 1.1.5.

Sorry, I passed by this explanation. Now it's working fine. Ty.
Title: Re: Site integration Mod
Post by: [unplugged] on May 16, 2008, 12:35:06 PM
No problem at all.  ;D

Glad I could help.
Title: Re: Site integration Mod
Post by: Nathaniel on May 20, 2008, 02:09:21 AM
Unfortunately the SMF team do not want me to use the ExtraSettings Mod which has code effectively copied straight from SMF 2 beta. This means that you have to use v1.2 of the Mod if you have SMF 1.1.5 until I work out another way of fixing this problem.

This is likely to wait until about the time I start the CustomMenu Mod, in about 4 to 5 weeks time.

Sorry,  :'(
Title: Re: Site integration Mod
Post by: [unplugged] on May 26, 2008, 12:54:49 PM
I was signed in as a regular member earlier and noticed that all of the links that point to integration mod pages just took me back to the homepage. The problem is, I rarely sign in as a regular member, so I only noticed it just now...lol. I have checked to make sure the links were correct, and they were. I have checked to make sure I didn't have anything set up for admins only. I checked through the permissions, but I didn't see anything that would offer clues as to why this is happening. Knowing me, I have probably looked over something really simple (I've done worse).
Title: Re: Site integration Mod
Post by: Nathaniel on May 26, 2008, 05:19:03 PM
Quote from: SunKing on May 26, 2008, 12:54:49 PM
I was signed in as a regular member earlier and noticed that all of the links that point to integration mod pages just took me back to the homepage. The problem is, I rarely sign in as a regular member, so I only noticed it just now...lol. I have checked to make sure the links were correct, and they were. I have checked to make sure I didn't have anything set up for admins only. I checked through the permissions, but I didn't see anything that would offer clues as to why this is happening. Knowing me, I have probably looked over something really simple (I've done worse).

You have probably not set the permissions for the groups that you want to view the page, for version 1.3 you have to set the permissions for every page, otherwise only the admin can view them. I will make a note of this on the Mod page to make it clearer.
Title: Re: Site integration Mod
Post by: [unplugged] on May 26, 2008, 06:13:16 PM
Setting the permissions has indeed done the trick. I could have sworn I had already set those.  :P

Thanks.
Title: Re: Site integration Mod
Post by: scvoyager on May 29, 2008, 06:18:50 PM
I can't seem to get this to work. I run a nightlife forum and have seperate web pages for bar and hotel reviews. I copied the barreviews folder to the root with the smf files and folders, changed the html files to php and set the action to the folder barreviews and all it does when you click the action=barreviews is go to the smf home page. Am I missing something?
Title: Re: Site integration Mod
Post by: [unplugged] on May 29, 2008, 08:00:14 PM
"action=" has to point to the files inside the barreviews folder (also make sure you have added the barreviews folder to this list of folders searched by the mod).

Let's say you have two files inside the barreviews folder named thisaction.php and thataction.php. Your action would then be written out as http://www.yoursite.com/yourforum/index.php?action=thisaction and http://www.yoursite.com/yourforum/index.php?action=thataction.

The action name is simply the file name without the ending ".php".
Title: Re: Site integration Mod
Post by: scvoyager on May 30, 2008, 08:51:51 PM
Quote from: SunKing on May 29, 2008, 08:00:14 PM
"action=" has to point to the files inside the barreviews folder (also make sure you have added the barreviews folder to this list of folders searched by the mod).

Let's say you have two files inside the barreviews folder named thisaction.php and thataction.php. Your action would then be written out as http://www.yoursite.com/yourforum/index.php?action=thisaction and http://www.yoursite.com/yourforum/index.php?action=thataction.

The action name is simply the file name without the ending ".php".
Thank you for your help. I figured out the problem, my home pages for bar reviews and hotel reviews were named index.html and when I changed them to index.php they would run home to mama (smf home site). I have renamed these files and now everything is working great.

This is a real cool mod...
Title: Re: Site integration Mod
Post by: Nathaniel on May 30, 2008, 09:00:39 PM
Quote from: scvoyager on May 30, 2008, 08:51:51 PM
Thank you for your help. I figured out the problem, my home pages for bar reviews and hotel reviews were named index.html and when I changed them to index.php they would run home to mama (smf home site). I have renamed these files and now everything is working great.

This is a real cool mod...

Thank you, Its actually a really simple mod as well, which makes it a win win situation for everyone. :)

If you have any suggestions for features that you think could be added to it then please feel free to have some input. I will probably do another version of this mod in a few weeks, with an attempt at making version 1.3 work with SMF 1.1.5 as well as any other new features that I think that it could need.

I will also do the Custom Menu Mod then to.
Title: Re: Site integration Mod
Post by: openinteractive on June 06, 2008, 02:29:05 AM
Ive loaded and installed the Site Integration Mod (v.1.2) in my forum SMF v.1.1.5, but cannot find the Site Integration Tab under "Features and settings" section-> "Site Integration" tab.

there simply is no Site Integration Tab. is there something im missing?
Title: Re: Site integration Mod
Post by: Nathaniel on June 06, 2008, 04:42:07 AM
Hmm, it should be there. Are you sure that the mod installed correctly?

It should really be "Features and Options" for smf 1.1.5 if that helps.

The only error that I can think of, would be an error with the installation of the language files. Try visiting the pages direct url ('index.php?action=featuresettings;sa=siteintegration;') for your website, to see if the page is actually there.

I can only recommend that if you can't find it using the direct url and or the tab, then you uninstall the mod and then reinstall it, because some of the language strings may not have installed correctly.

There could also be a problem if you are trying to use this with a language other than English or English-utf8, because these are the only languages with translation strings for this mod. Which language are you trying to view the page in?


Title: Re: Site integration Mod
Post by: Nathaniel on June 07, 2008, 10:14:17 AM
I am happy to announce that I have updated this Mod so the version 1.3 works with SMF 1.1.5 and 1.1.4.

Full changes, v1.3.1:
A minor bug fix, two of the settings had similar names and this created an annoying bug.
Updated version 1.3 so the it supports SMF 1.1.5 and 1.1.4.

Unless there are any more bugs, that will probably the last version of this Mod until I need to update it for the newer versions of SMF 2 Beta. I could also make an update if anyone can think of any other features that it could have, but at this stage I am just happy that the good features are now working for both versions of SMF.

I will however be updating the mod page explanation and putting a few more demo sites up, within the next few days.

Edit: Naturally I have just thought of some more features that this mod could have, they include:
Defining an action/title for the whos online page and etc., so that the user will not be shown as 'viewing unknown', as well as settings for the admin to control this feature.

I will do another update to version 1.4, in a few weeks at the latest, after I can completed some other mods. Any suggestions for new or more advanced features would be most welcome.

Thanks to all,
~LHVWB
Title: Re: Site integration Mod
Post by: jglonek on June 08, 2008, 12:41:42 AM
I'm sorry if this has been mentioned somewhere, but I had a question about how this mod works. It seems like you have to be logged in to pull up any pages with it. I wanted to use it to give a default news page when a user visits the site that is called with this mod, without requiring them to log in to view it. is that possible?
Title: Re: Site integration Mod
Post by: Nathaniel on June 08, 2008, 12:49:59 AM
Yep, you can change the permissions of the included action/file that you want them to view, so that guests can view the page.

You can change permissions for particular included actions/files, by clicking on the 'manage' link which is next to them in the list of included actions/files. This list should be in the Site Integration Settings tab, if you are using SMF 1.1.5 with v1.2 of this mod then please upgrade to version 1.3.1.


Settings are found in the admin panel.
For SMF 1.1.5: "Features and Options" section-> "Site Integration" tab.
For SMF 2.1 Beta: "Configuration" dropdown menu -> 'Modifications' -> 'Site Integration' Tab.

Remember that by default, only admin have the permissions to see the pages, you need to specifiy permissions if you want anyone else to view the pages.
Title: Re: Site integration Mod
Post by: fangweile on June 08, 2008, 05:57:03 AM
hello there,

I installed this mod and works fine.

I want to create an action linked to my coppermine index but I can't find the file in the site integration menu. Is the "index.php" is not included in site integration.
Title: Re: Site integration Mod
Post by: Nathaniel on June 08, 2008, 06:08:29 AM
The index.php file is specifically ignored so that you can have a file called index.php which protects your directory and the files in it. If the name of the file doesn't matter then try renaming it to coppermine.php or something similar, otherwise you can edit the code that the mod changed in SMF's index.php page, you can remove the restriction on line ~357 of that file, I can show you exactly how if necessary.

I would personally recommend trying to find an alternate method of integrating coppermine with SMF however, because its unlikely that you will get the results that you want with this Mod. This mod is not designed to integrate entire software packages into SMF, so it may have some odd results, depending on how coppermine works, although I have never used coppermine so I can't be sure.

There is a tutorial on integrating coppermine with SMF below:
http://www.siteground.com/tutorials/coppermine/coppermine_smf.htm
Title: Re: Site integration Mod
Post by: fangweile on June 08, 2008, 06:33:27 AM
thanks a lot for your reply.

I already integrated my coppermine and smf . I have tried your suggestion but it doesn't work either.
I just want to  make an action for my gallery without redirection.
Title: Re: Site integration Mod
Post by: Nathaniel on June 08, 2008, 06:56:39 AM
If you have tried my suggestions, then the only other solution that I can think of, is the use of an iframe (http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5) or something similar to load your coppermine site, this might work the best, however you would have to strip the coppermines template so that it can fit into the iframe in the smf template, but its probably possible.  ???

If you did that then you would create a separate file/action called something like coppermine, and then put an iframe on it that shows the coppermines part of your site.

Its nasty but it might just work!  :-\
Title: Re: Site integration Mod
Post by: fangweile on June 08, 2008, 07:55:01 AM
Alright, I already used iframe before but I don't like it's output.
If you look at my gallery here www.allkoreans.net/gallery
You will notice that the active menue is pointed to [home] that is supposed to in the [gallery] button.
I just think that your mod will fix this problem.

Thanks a lot anyway for your suggestions. Really appreciated it. ^_^
Title: Re: Site integration Mod
Post by: Nathaniel on June 08, 2008, 08:08:44 AM
Oh okay, that should be easy to do. Open up the template_menu() function from the index.template.php file for your theme and set a check for a variable that is only declared by the gallery, sorry about the bad explanation but if you have a look at the function, you should be able to work it out.

There should be some condition checking for the currently selected button, you just need to change that slightly so that it checks for some variable which is a part of coppermine.
Title: Re: Site integration Mod
Post by: openinteractive on June 09, 2008, 01:49:45 AM
just uninstalled the site integration mod that wasnt working and then installed the newest version you just posted. but still does not show up in "settings and options". and ('index.php?action=featuresettings;sa=siteintegration;')  just shows the home page.

do i need the SMF Extra Settings Framework Mod? and if so, where can i download it.
there doesnt seem to be any results when i search the mod site.

im installing with english version language.
Title: Re: Site integration Mod
Post by: Nathaniel on June 09, 2008, 02:05:58 AM
Okay, that's really odd!

You don't need the "SMF Extra Settings Framework Mod", that no longer exists and is no longer necessary for the running of this mod, there is an explanation of why you don't need it (http://www.simplemachines.org/community/index.php?topic=236625.msg1549465#msg1549465).

I have attached an image of what I see, about the location of the settings area. If its definitely not there then try directly using your forums url with 'index.php?action=featuresettings;sa=siteintegration;' at the end, eg 'www.yourdomain/index.php?action=featuresettings;sa=siteintegration;'. If that doesn't work then the mod can't have installed properly, and you should post your 'sources/ModSettings.php' file, so I can see what the mod failed to change.
Title: Re: Site integration Mod
Post by: jglonek on June 09, 2008, 09:17:58 AM
Quote from: LHVWB on June 08, 2008, 12:49:59 AM
Yep, you can change the permissions of the included action/file that you want them to view, so that guests can view the page.

Ah well that's good to know I can do it! Except it's not working :(

I have SMF 1.1.5, and Integration 1.3.1. When I go to the Features and Options for it I can see at the bottom where it says "Manage Included Files/Actions".. but nothing is listed. Now I know that it's finding the files in the folder I told it to look in because the action links work that I've been playing with over the weekend.

So how do I get the files to appear in the managed area?

----

Oh and also, although I'm not sure this is an issue with the mod, we are using the Orange-lt theme and when we go to Features and Settings we see "Basic Features |  | Layout & Options | Karma". For some reason Site Integration isn't showing up in that | | area. We have to reset the theme to default SMF to bring the link up

---

And apparently a third issue. It seems like I can't have a call to a sql database in whatever file is being included in the action call. If I do I just get a "page cannot be displayed" error. Is there a way around this?
Fixed this issue! Apparently it needs to be in the same database. got it.
Title: Re: Site integration Mod
Post by: Nathaniel on June 09, 2008, 05:31:40 PM
Put the below code into one of your actions, it should produce a list of the actions which are being included by your program, could you please post those results?

var_dump($context['siteintegration_actions']);

I am not sure about the theme error, I will look furthur into that later today.

Title: Re: Site integration Mod
Post by: jglonek on June 10, 2008, 04:58:34 PM
Quote from: LHVWB on June 09, 2008, 05:31:40 PM
Put the below code into one of your actions, it should produce a list of the actions which are being included by your program, could you please post those results?

var_dump($context['siteintegration_actions']);

I am not sure about the theme error, I will look furthur into that later today.

As in just put that code into one of my php files that I'm calling as an action and see what it says?

If I do that I Get:

array(0) { }

So maybe I didn't do it right.
Title: Re: Site integration Mod
Post by: openinteractive on June 10, 2008, 05:08:40 PM
Hey there,
nothing showing up for me in admin. and linking directly just shows me the home page.
i have attached my mod settings file as you requested. I appreciate any help you can offer.

thanks,

Joe
Title: Re: Site integration Mod
Post by: Nathaniel on June 10, 2008, 06:24:13 PM
Quote from: openinteractive on June 10, 2008, 05:08:40 PM
Hey there,
nothing showing up for me in admin. and linking directly just shows me the home page.
i have attached my mod settings file as you requested. I appreciate any help you can offer.

thanks,

Joe

Okay, thank you for attaching the file.

From what I can tell, the mod hasn't installed at all, because none of the edits have been made to that file. I would suggest trying to reinstall it again, however make sure that you are installing it correctly this time, remember that you should try to install it via the package manager and that it should have no errors when you try to install it.

If necessary then you may wish to try manual installation, you can get 'Manual Install Instructions for SMF' from the mod download page. I do however recommend trying to install the mod properly.
Title: Re: Site integration Mod
Post by: Nathaniel on June 10, 2008, 06:48:37 PM
Quote from: jglonek on June 10, 2008, 04:58:34 PM

As in just put that code into one of my php files that I'm calling as an action and see what it says?

If I do that I Get:

array(0) { }

So maybe I didn't do it right.

Okay, I worked out how to solve the theme error, your custom theme 'orange-lt', actually has its own Modifications.english.php file, this means that whenever you install a mod, all of its language strings will go into the default templates language files, but when using the custom theme you will be using its own language file and you won't have access to the mods language strings.

To fix this I would recommend that you open up your 'Modifications.english.php' file from the default template ('themes/default/languages/Modifications.english.php') and then copy the contents (excluding the php tags <?php and ?>) into the 'Modifications.english.php' file from your custom theme ('themes/(theme name)/languages/Modifications.english.php'), be careful not to delete any of the current language strings from the custom themes file though because that could stuff the theme up.

I can perform the edits if you post the Modifications.english.php file from the custom theme.

In terms of your manage actions/files issue, I am not sure why this would be happening, could you please post your main smf index.php file? That's where the included files/actions are defined, so thats where any error would be. Although its possible that there may be an error with your 'sources/Modifications.php file'.
Title: Re: Site integration Mod
Post by: openinteractive on June 10, 2008, 06:49:53 PM
ok, i may have to try the manual install.
ive tried to install using the package manager several times.
ill let you know how it goes. much thanks!

joe
Title: Re: Site integration Mod
Post by: openinteractive on June 10, 2008, 10:59:54 PM
got it working in my degault theme. ill have to also add it to my new theme manually.
but it works! im so excited.

thanks so much for your help
Title: Re: Site integration Mod
Post by: jglonek on June 11, 2008, 09:44:05 AM
Quote from: LHVWB on June 10, 2008, 06:48:37 PM
Okay, I worked out how to solve the theme error, your custom theme 'orange-lt', actually has its own Modifications.english.php file

In terms of your manage actions/files issue, I am not sure why this would be happening, could you please post your main smf index.php file? That's where the included files/actions are defined, so thats where any error would be. Although its possible that there may be an error with your 'sources/Modifications.php file'.

Putting the code into the theme's modification file worked! Now I can see the Site Integration information under our normal theme, thanks!

I've attached the main index.php to this reply. I don't have a modifications.php file.. I have a modsettings.php which I've attached as well.
Title: Re: Site integration Mod
Post by: Nathaniel on June 11, 2008, 05:27:01 PM
It appears that you performed some of the required edits 3 times, in the index.php file this meant that after the first time it scanned for files, it would wipe the array which lists the included files/actions and then it wouldn't add any new ones to it.

Anyway, I performed the required edits and the new and tested files are attached.
Title: Re: Site integration Mod
Post by: jglonek on June 11, 2008, 11:47:53 PM
It works now, thanks! I really appreciate it :D
Title: Re: Site integration Mod
Post by: SilverKnight on June 20, 2008, 07:15:02 PM
I really don't get this.. not very well documentated mod from what ive seen.. ok so ive installed the mod.. left with a number of boxes.. what now? what do i do??? what do i enter? what do i edit... all i want really is to put a simple banner and a few links.. yet it wont let me of course.. any other way around it.. how do i do this intergration mod ugh !!!  >:(
Title: Re: Site integration Mod
Post by: Nathaniel on June 20, 2008, 08:47:01 PM
Quote from: SilverKnight on June 20, 2008, 07:15:02 PM
I really don't get this.. not very well documented mod from what Ive seen.. ok so ive installed the mod.. left with a number of boxes.. what now? what do i do??? what do i enter? what do i edit... all i want really is to put a simple banner and a few links.. yet it wont let me of course.. any other way around it.. how do i do this intergration mod ugh !!!  >:(

I apologize if my explanation and documentation aren't very clear, its not particularly an area that I have great skill in. However from what you said, you may be trying to use this mod for something that it can't be used for.

This mod is used to include your .php files into the SMF system so that you can access them by going to index.php?action=filename.

If you want to put a different banner into your theme or add some links into the theme, then I suggest that you ask about that in the Graphics and Templates (http://www.simplemachines.org/community/index.php?board=34.0) forum.

I will have a read over my documentation on the download page to see if there is anything that I can make clearer.

Edit: I am happy to try to explain to you how exactly you can use the mod, if you tell me exactly what you want to do.





Title: Re: Site integration Mod
Post by: Nathaniel on June 20, 2008, 09:31:13 PM
Okay, I have done a full update of the Mod download page documentation. Please have a read of it and tell me what you think. I will try to update the "More information" section to make it more clearer when I get some time.

Please tell me if you find any issues with the documentation, I am more than happy to try to fix it and make it clearer.

Thank you,
LHVWB
Title: Re: Site integration Mod
Post by: [unplugged] on June 20, 2008, 09:47:49 PM
I had no problem understanding what this mod was for, and how to implement it, so the instructions/documentation for it must have been at least moderately adequate. A simple request for a more detailed explanation would have sufficed.
Title: Re: Site integration Mod
Post by: digit on June 23, 2008, 03:03:16 AM
So am I correct in thinking that the functionality is the same as the CustomAction mod?
Title: Re: Site integration Mod
Post by: Nathaniel on June 23, 2008, 03:17:52 AM
Quote from: digit on June 23, 2008, 03:03:16 AM
So am I correct in thinking that the functionality is the same as the CustomAction mod?

No, they are very similar, but the Custom Action Mod stores the files in a database meaning that you cannot easily access them from outside SMF, while the Site Integration Mod allows you to create/edit your pages outside of SMF, meaning that you can use your own WYSIWYG editor and etc to create/edit your pages.

It also has the "Language Includes" settings and invalid permissions settings (redirection action and show guests login page) and etc. I am also planning to add the ability to list the actions in the whosonline list, to change your home action (eg index.php) and to make a 404-like error action system which allows you to show users a certain action if they try to load an invalid action - in the way that vBulletin does it, as opposed to just showing the home page (normally board index) you will be shown a page saying something like "Sorry you must have followed an invalid link, please report this to the site admin by clicking here.".

I am adding features to the Site Integration Mod which could be useful to anyone trying to integrate their website with SMF, not just people that want to add new actions, although that is the main function of this mod.

In short, the Site Integration Mod is aimed more at people who don't want to mess around with editing SMF source code or using the SSI.php functions but still want the power of editing their own code in their own editor, while the Custom Menu Mod is for people that want to add simple actions to their forums with the least amount of fuss.

Edit: PS: Sorry about the huge post! ;)

Extra note to everyone:
I will be finishing up one of my other mods and then updating this mod to version 1.4, it should be updated sometime within the week.

Thank you,
LHVWB.
Title: default home page with SIM
Post by: openinteractive on June 27, 2008, 02:25:21 PM
Is there an easy way to define one of my site integration pages as the default home page of my forum?

for example /index.php?action=home points to my home.php file. but t get there i have to specifically link to that action, where as i would like to just have /index.php default to this file and just use my action=forum to go to the forum page.

ive been digging through alot of code, but dont see any where obvious to make this happen.

any help appreciated.

thanks,

joe
Title: Re: Site integration Mod
Post by: [unplugged] on June 27, 2008, 05:53:17 PM
You could just use .htaccess to point visitors to any page you want them to "start" at. Google for how to use it (that's what I did).  ;)
Title: Re: Site integration Mod
Post by: Nathaniel on June 27, 2008, 09:06:04 PM
Ironically, this is going to be a feature of the next version of this mod as I have stated in some of my other posts, and it could have been a feature of the last version except that I was going to add it to a different mod, but now its going to be a part of this one.  I should start work on the new version in a few days after I have finished some of my other mods, it will hopefully be finished before next weekend. :)
Title: Re: Site integration Mod
Post by: ianus on June 28, 2008, 11:24:04 AM
Greetings!

First, some basic information.
Im runnig SMF 1.1.4 with TP 0.98 and a custom theme based on default.
I like to show a DokuWiki in this environment and dislike the iframe solution (because of the stupid "high= xx px" setting.

Maybe your mod is not written to support "complex" software, but I like to try it.
Quote from: LHVWB on June 08, 2008, 06:08:29 AM
This mod is not designed to integrate entire software packages into SMF, so it may have some odd results

After downloading SiteIntegrationMod_v1.3.1 (http://custom.simplemachines.org/mods/index.php?mod=1146), the PacketManager give me the hint, that the SMF Extra Settings Framework Mod must be installed.
Well this was mentioned here before.
http://www.simplemachines.org/community/index.php?topic=236625.msg1544297#msg1544297

The given link seems to lead to a protected site, which is explained also.

But after reading this
Quote from: LHVWB on June 07, 2008, 10:14:17 AM
I am happy to announce that I have updated this Mod so the version 1.3 works with SMF 1.1.5 and 1.1.4.

Full changes, v1.3.1:
A minor bug fix, two of the settings had similar names and this created an annoying bug.
Updated version 1.3 so the it supports SMF 1.1.5 and 1.1.4.
I thought, this mod will work with 1.1.4, but the PaketManager told me that there is an error in Sources/ManageServer.php

So. Questions are:
What do I need to install this mod and where can I get it?
Has somebody give a try to integrate more than a single php page?

Thanks in advance.

Regards
ianus
Title: Re: Site integration Mod
Post by: Nathaniel on June 28, 2008, 07:23:12 PM
What do I need to install this mod and where can I get it?
As I said in that earlier post, you no longer need that other mod to run the Site Integration Mod for SMF 1.1.4 or SMF 1.1.5. That was the whole point of the 1.3.1 version of the mod. I am sorry that I forgot to remove the message about it in the install page, and I am sure that it has created some confusion, I will definetly remove it when I update this mod next (~1week).

Has somebody give a try to integrate more than a single php page?
I have no idea, there was somebody earlier who gave this a go, but I am not sure how successful they were.  If you could do it then it would involve steps like changing the base url of the software package to an action within SMF, renaming the index.php (of the software package) to something else (say wiki.php for action=wiki) and etc. I am happy to try and give this software package a go when I get some time.

I am not sure about your error with 'Sources/ManageServer.php', I have tested this mod severa timesl (and again just now) with clean versions of SMF 1.1.4, and it installed and worked perfectly. It is possible that there may be some clashes with other mods, if you post your 'Sources/ManageServer.php' then I may be able to find out what the problem is.

Title: Re: Site integration Mod
Post by: openinteractive on June 28, 2008, 10:42:13 PM
thanks for the suggestions guys.
i ended up using a not so elegant hack to the index.php file.

simply added the following:

if(!$_GET["action"]){
   $_GET["action"] = "home";
}


basically if action is not set, define it as home.
which happens to be my home page file name....

just thought id share in case anyone else needs a temporary fix until the next version is available.

cheers!

Title: Re: Site integration Mod
Post by: rawonam on June 29, 2008, 03:44:05 PM
I've got two questions/suggestions...
1) Why do you need to rename files to .php? Wouldn't .html be nicer for articles?
2) Wouldn't it be better instead of adding the protection code at the beginning, to add a redirection code, so that, for instance, domain.com/myarticle.html would open the article within smf?..
Title: Re: Site integration Mod
Post by: ianus on June 29, 2008, 07:59:56 PM
Greetings!

Reply to:
http://www.simplemachines.org/community/index.php?topic=236625.msg1595411#msg1595411


Confusion – one of my best friends.
You are right, of course. I have asked only to be sure and as you said, nothing but the mod itself is necessary.


The Sources/ManageServer.php Problem.
I don´t know what causes this error message. The PacketManager changed the code correctly.
I have checked it manually before and after choose the "install anyway button".

Something with the code for the ModSettings - the part after // Handles the Site Integration Settings - seems to cause the problem.
After adding the code manually, everything works as expected.

So thanks for your reply and for this mod. Your kind support is appreciated.
Title: Re: Site integration Mod
Post by: Nathaniel on June 29, 2008, 09:12:20 PM
@rawonam

Okay, fair comments/suggestions,.

1) I supose that I could add this into the next version of the Mod, I will have a look into this. One of the issues with this is making sure that I cover as many different extension types as possible, off the top of my head I can think of '.html' and '.htm' which I could add, if there are any others which you think should be added then please post them.
2) Yes, that would probably work better, I will add that to the documentation.

Thank you for the comments/suggestions, I am always open to them, especially ones that will improve the mod in any way. :D

@ianus

If you need anymore help then feel free to ask, I'm always happy to help! :D
Title: Re: Site integration Mod
Post by: KarKess on June 30, 2008, 04:13:04 AM
I'm using smf 1.1.5 and after installation all I get is a bunch of code at the top of the screen.  Any suggestions?

Thanks,

Karl
Title: Re: Site integration Mod
Post by: Nathaniel on June 30, 2008, 04:25:45 AM
Quote from: KarKess on June 30, 2008, 04:13:04 AM
I'm using smf 1.1.5 and after installation all I get is a bunch of code at the top of the screen.  Any suggestions?

Thanks,

Karl
I am not sure what you error could be.. Could you please post the code that appears at the top of the forums, so that I can try to find the problem?
Title: Re: Site integration Mod
Post by: KarKess on June 30, 2008, 01:12:45 PM
here's a screen shot.  Also this shows on every page of the forums. :(
(http://www.theforumhub.net/screenshot.bmp)
Title: Re: Site integration Mod
Post by: [unplugged] on June 30, 2008, 06:07:21 PM
It looks like all of your code was added on one line (no linebreaks). This has been happening quite a bit and with several mods. The only way I know of to "fix" it is to manually go into each modified file and add the linebreaks (enter) where needed. Not much of an answer per se but a good starting point.  ;D
Title: Re: Site integration Mod
Post by: Nathaniel on June 30, 2008, 07:44:44 PM
@KarKess, I am not sure how you managed to do this, but it appears that the changes have been made to the wrong spot within the modifications.english.php file. You can fix this by manually opening up your /themes/{themes to change}/languages/modifications.english.php file and moving the ?> php tag from before that code which is being shown on the page, to the end of the file.

Is it possible that you are using english-utf8? Because my mods language edits for that could theoretically have some bugs .

@ SunKing, that actually wasn't the issue but good guess. :) The reason that its all on one line is because its separated by a line break in the .php file which html doesn't recognize as a line break, instead it just shows it as a single space.
Title: Re: Site integration Mod
Post by: KarKess on July 01, 2008, 07:46:36 AM
I'll try that, but won't have time to really get into it until the weekend. I will update and let you know how it went.  Thanks for the speed of you replies.
Title: Re: Site integration Mod
Post by: KarKess on July 01, 2008, 03:49:16 PM
Ok I got it working, but I don't have a clue how to use it. Can you give examples of what info should be put in the fields?  I want to make my site look like this (http://www.simplemachines.org/community/index.php?action=dlattach;topic=245474.0;attach=59639;image)  And want to know what I have to do.  Do I need to make a new file with just my header and footer?  Or can I just use my index file?  And can I link directly to this file?  Or do I need to put a copy of it elsewhere?


Thanks
Title: Re: Site integration Mod
Post by: erlend_sh on July 01, 2008, 04:17:56 PM
Hey! He used it for a custom menu! I thought this mod didn't do that? :P How will your "Custom Menu Mod" do this any different?
Title: Re: Site integration Mod
Post by: KarKess on July 01, 2008, 07:45:51 PM
No that is just a photoshop edit, but this is what I want my site to look like.
Title: Re: Site integration Mod
Post by: Nathaniel on July 04, 2008, 04:29:23 AM
Okay, first of all. Sorry that I haven't replied earlier, I have been 'on hiatus' ;) for a few days, having a holiday.

@ KarKess, I am not entirely sure that you are trying to use this Mod for what it is meant to do, this mod is meant to allow you to include your own files as actions into your SMF install, it appears that you actually want to edit the template files so that your forums appear different. You can get some help with that from the "Graphics and Templates" (http://www.simplemachines.org/community/index.php?board=34.0) forum, which discusses editing template files. You can find the template_header() and template_footer() functions which you will need to edit, in the index.template.php file for each of your themes.

This Mod can help you to create a page that uses that header and footer from the template along with certain benefits from integration with the SMF member system and etc., and puts your own custom page in between.
Title: Re: Site integration Mod
Post by: KarKess on July 04, 2008, 05:36:43 AM
Gotcha! ;)  I'm mistaken, I thought this mod actually put smf on your web page using your webpages' header and footer placing smf in between.  Dangit, this means work.  Hi-Ho-Hi-Ho!
Title: Re: Site integration Mod
Post by: Nathaniel on July 04, 2008, 08:11:47 AM
Quote from: KarKess on July 04, 2008, 05:36:43 AM
Gotcha! ;)  I'm mistaken, I thought this mod actually put smf on your web page using your webpages' header and footer placing smf in between.  Dangit, this means work.  Hi-Ho-Hi-Ho!

Unfortunately customising your SMF install so that it works the way you want it, can sometimes mean 'getting your hands dirty' with some php coding. ;) But its always a fun learning experience. :D

I'm sure that plenty of people will be willing to help out (myself included) if you have any problems. :)
Title: Re: Site integration Mod
Post by: openinteractive on July 05, 2008, 03:07:21 PM
Quote from: openinteractive on June 28, 2008, 10:42:13 PM
thanks for the suggestions guys.
i ended up using a not so elegant hack to the index.php file.

simply added the following:

if(!$_GET["action"]){
   $_GET["action"] = "home";
}


basically if action is not set, define it as home.
which happens to be my home page file name....

just thought id share in case anyone else needs a temporary fix until the next version is available.

cheers!


So as it turns out, this method doesnt really work like i though. while inside the forums, the url pat changes to this format: /index.php/board,3.0.html
which seems to cause problems in the navigation.

so i guess ill wait for your next version to be complete. any questimation on when that might be?

thanks for the sweet mod. looking forward to the next version!
Title: Re: Site integration Mod
Post by: Nathaniel on July 05, 2008, 08:48:34 PM
Quote from: openinteractive on July 05, 2008, 03:07:21 PM
so i guess ill wait for your next version to be complete. any questimation on when that might be?

thanks for the sweet mod. looking forward to the next version!

Yeah, sorry about the wait. I went on a small holiday where I didn't have a computer so I couldn't do any more work on any of my Mods. In terms of a timeframe, I am going to try to update it in the next few days if my time permits, otherwise I definitely hope to have it finished before the end of the week.

Currently I am going to add searching and including of these extensions types.
.php, .html, .htm

If you can think of any others then please tell me.

I am thinking about giving admin a choice of extensions to include anyway, so its not the important.
Title: Re: Site integration Mod
Post by: Nathaniel on July 07, 2008, 11:28:10 PM
I have now updated the Mod to version 1.4, below is a list of the extensive changes that were made for the new version. I will update the documentation on the download page sometime in the next few hours.

v1.4 Changes.
A minor bugfix, there was a html error in the template file, also fixed displaying of Mod version.
Removed 'official' support for SMF 1.1.4 and SMF 2 Beta 3.0, although the mod should still work for them.
Added settings to change home/default and error actions.
Added option to display the title of an included action in the whosonline list.
Added the use of custom file extensions.
Added a language string prefix for included titles, and implemented checking for a language string for them.

I know that I've said this before, but I am going to try to stop ;) adding new features to this mod, unless there are any really useful ones that somebody can think off. I want to finish my other mods and do some work, I will however still be fully supporting this mod and slowly developing it, and update it for future versions of SMF.

I chose to remove the 'official' support for SMF 1.1.4 and SMF 2 Beta 3.0 because I don't want to use the time to check that this mod works for those older versions, its difficult enough making it work for two completely different versions, let alone checking it for older versions.

Thank you,
LHVWB
Title: Re: Site integration Mod
Post by: [unplugged] on July 08, 2008, 12:30:16 AM
I installed the latest version of the mod under SMF 2.0 and receive the following error:

Fatal error: template_siteintegration(): Failed opening required '/home/content/*****/html/forum/s' (include_path='.:/usr/local/lib/php') in /home/content/*****/html/forum/Sources/Load.php(2204) : eval()'d code on line 21

The s is the first letter of the folder that the actions are in (I changed the name of the folder a few times and each time that letter is the first letter of the newly named folder).

      //   Include the page.
      require_once($context['file_include']);

is where the error is occurring I believe (Line 21).


EDIT:  If I hardcode the $folder and $current_folder to point to my actions folder, then all works as desired.
Title: Re: Site integration Mod
Post by: Nathaniel on July 08, 2008, 01:07:27 AM
Okay, I'll check the mod and see if I can reproduce the error.

Edit: I am having difficulty trying to reproduce the error, it seems to work fine for me...

Could you please post your index.php file?

I believe that the last version of the Mod may not have uninstalled properly on your forum, this error actually occurs where the actions are added to the $context['siteintegration_actions'] array. You probably have some code from the last version of the mod overriding this array, you probably have two sets of similar code after the $actionArray is defined.

The odd error with the one letter being passed is because in LoadFile.php I use the code "$context['file_include'] = $boarddir."/".$context['siteintegration_actions'][$context['current_action']][0];" to get the location of the current action's file, which is stored as the first element in an array for version 1.4, but for version 1.3.1 its stored as a string, so taking the first element of that string means taking the first letter... ;) When the old code overrides the $context['siteintegration_actions'] array, it replaces the array values with strings thus causing your annouying error...  :(

To say it more clearly, this is not an error with the new version of the Mod. Its just one of those annoying errors that you get sometimes, I think that its the package managers fault, unless you forgot to remove everything and you uninstalled it manually... ;)
Title: Re: Site integration Mod
Post by: Nathaniel on July 08, 2008, 02:18:21 AM
Hmm, I just did another small update, of the mod. I didn't bother changing the version number though, there was just an error where users could get into an infinite loop of redirections if they don't have the permissions to view the home or invalid action pages/actions.... ;) Problem Fixed! :D
Title: Re: Site integration Mod
Post by: Sudhakar Arjunan on July 08, 2008, 02:36:42 PM
Hey LHVWB,

I am trying to install in My Forum.

Found the index.php page is error - 1.     Execute Modification     ./index.php     Test failed

I had tried to mod it manually, and found the // Action and board are both empty... BoardIndex! in index.php was been failed to patch.
Since am using Simple Portal in my forum.

will code the difference here ,


// Action and board are both empty... BoardIndex! if (empty($board) && empty($topic)) { // Allow the system to continue... // This must happen because there may be a custom default/home action, in the as yet undefined array. $load_home = true; }


The code which is there when i install Simple portal is ,


// Action and board are both empty... SPortal!
if (empty($board) && empty($topic))
{
require_once($sourcedir . '/SPortal.php');
return 'SPortal';
}
if (empty($board) && empty($topic) && (isset($_GET['cat']) || isset($_GET['page'])))
{
require_once($sourcedir . '/SPortal.php');
return 'SPortal';
}


Kindly check out and tell me what i have to do to install Site Integration mod.
Title: Re: Site integration Mod
Post by: [unplugged] on July 08, 2008, 06:13:14 PM
I am having some problems with my package manager, so that's probably the culprit.

I've attached my index.php.

Thanks for your time.
Title: Re: Site integration Mod
Post by: Nathaniel on July 08, 2008, 09:10:10 PM
@SunKing, I have had a look at your index.php file and removed the parts added by the old version of the mod. The first attached index.php has no version of the mod installed, while the second has the latest version (1.4) so that you can see what your index.php file should look like after you installed it on the first index.php file. I hope that made sense... ;)

@asudhakar, I have next to no experience with Simple Portal, but I will have a look at the confliction and see if there is a way around it. I will post back when I find a way...
Title: Re: Site integration Mod
Post by: [unplugged] on July 08, 2008, 09:22:18 PM
Thank you much. It works great now.
Title: Re: Site integration Mod
Post by: Nathaniel on July 08, 2008, 10:00:12 PM
@asudhakar, I believe that I have the solution to the compatibility issues between these two mods. I am going to structure the rest of this post as a tutorial as a reference for any one else that wants to use these two mods together.


Fixing Compatibility between the Site Integration Mod v1.4 (http://custom.simplemachines.org/mods/index.php?mod=1146) and the Simple Portal Mod v1.2 (http://custom.simplemachines.org/mods/index.php?mod=1104) for SMF 1.1.x:


Please note that this tutorial assumes that you do install Simple Portal v1.2 first, and then the Site Integration Mod v1.4.

First you will need to install "Simple Portal v1.2 (http://custom.simplemachines.org/mods/index.php?mod=1104)" and then install the "Site Integration Mod 1.4 (http://custom.simplemachines.org/mods/index.php?mod=1146)", there SHOULD be errors for the install of the Site Integration Mod. However, please check that the only errors occur for the index.php file for the Site Integration Mod, those are the ones that the rest of the tutorial will show you how to fix.


Find this Code:
        // Action and board are both empty... SPortal!
        if (empty($board) && empty($topic))
        {
            require_once($sourcedir . '/SPortal.php');
            return 'SPortal';
        }
        if (empty($board) && empty($topic) && (isset($_GET['cat']) || isset($_GET['page'])))
        {
            require_once($sourcedir . '/SPortal.php');
            return 'SPortal';
        }



Change to:
// Action and board are both empty... SPortal!
if (empty($board) && empty($topic) && (isset($_GET['cat']) || isset($_GET['page'])))
{
require_once($sourcedir . '/SPortal.php');
return 'SPortal';
}
elseif (empty($board) && empty($topic))
{
//require_once($sourcedir . '/SPortal.php');
//return 'SPortal';
$load_home = true;
}


Find this code:
// Place the forums home
'forums' => array('BoardIndex.php', 'BoardIndex'),


And add this code afterwards.
'portal' => array('SPortal.php', 'SPortal'),

You will now be able to access your Simple Portal at "index.php?action=portal", if you want to set it as your home page then go into the settings for the Site Integration Mod and set the "Forum Default/Home Action" setting to "portal".

(If you want to change the action which you access the Simple Portal Mod at, then change the 'portal' part of the last code change to the action that you want it to be at, be careful not to set it to an internal SMF action though.... ;))
Title: Re: Site integration Mod
Post by: scvoyager on July 10, 2008, 09:09:17 PM
Quote from: LHVWB on June 28, 2008, 07:23:12 PM
What do I need to install this mod and where can I get it?
As I said in that earlier post, you no longer need that other mod to run the Site Integration Mod for SMF 1.1.4 or SMF 1.1.5. That was the whole point of the 1.3.1 version of the mod. I am sorry that I forgot to remove the message about it in the install page, and I am sure that it has created some confusion, I will definetly remove it when I update this mod next (~1week).

Has somebody give a try to integrate more than a single php page?
I have no idea, there was somebody earlier who gave this a go, but I am not sure how successful they were.  If you could do it then it would involve steps like changing the base url of the software package to an action within SMF, renaming the index.php (of the software package) to something else (say wiki.php for action=wiki) and etc. I am happy to try and give this software package a go when I get some time.

If you are asking if someone has used this mod to integrate multiple websites then I will have to say yes. I'm currently running your great mod and currently have 4 sites integrated and these are not small websites. Some work needs to be done with changing urls manually but my biggest site that has over 1200 pictures and videos only took me a half hour to do. Permissions by website page will be my next step.

This mod is one of the best I have ever come across and we are all lucky to get it for free...

 
Title: Re: Site integration Mod
Post by: Nathaniel on July 10, 2008, 09:41:21 PM
@ scvoyager,
Thank you for the feedback. Its encouraging to know that somebody has made a good website with the help of this mod! :D
Title: Re: Site integration Mod
Post by: erlend_sh on July 10, 2008, 10:11:49 PM
Quote from: scvoyager on July 10, 2008, 09:09:17 PM(...)
I'm currently running your great mod and currently have 4 sites integrated and these are not small websites. Some work needs to be done with changing urls manually but my biggest site that has over 1200 pictures and videos only took me a half hour to do. Permissions by website page will be my next step.  
Could you please post a link to your site? It would be nice to see an example of how this mod has been used, because its exact intended usage still confuses me ;D
Maybe LHVWB could even use it as an example link?
Title: Re: Site integration Mod
Post by: Nathaniel on July 10, 2008, 10:14:28 PM
@ Sadr,
Yeah, I'm sorry that I haven't put a demo site up yet, I've been meaning to for ages, but whenever I get some time, I start making another Mod and then I forget to put up better documentation for the Mods that I've finished... Hopefully, I'll put up a demo site sometime within the next little while (a few days?)... ;)
Title: Re: Site integration Mod
Post by: scvoyager on July 11, 2008, 09:00:45 PM
Quote from: Sadr on July 10, 2008, 10:11:49 PM
Quote from: scvoyager on July 10, 2008, 09:09:17 PM(...)
I'm currently running your great mod and currently have 4 sites integrated and these are not small websites. Some work needs to be done with changing urls manually but my biggest site that has over 1200 pictures and videos only took me a half hour to do. Permissions by website page will be my next step.  
Could you please post a link to your site? It would be nice to see an example of how this mod has been used, because its exact intended usage still confuses me ;D
Maybe LHVWB could even use it as an example link?
Here is a link to one of the websites that has been integrated into smf. http://philippinenightlifeforum.com/index.php/action,hotels.html

Please note when you leave that link you will start working your way up to adult rated content!!!
Title: Re: Site integration Mod
Post by: openinteractive on July 15, 2008, 09:52:24 PM
Quote from: openinteractive on July 05, 2008, 03:07:21 PM
Quote from: openinteractive on June 28, 2008, 10:42:13 PM
thanks for the suggestions guys.
i ended up using a not so elegant hack to the index.php file.

simply added the following:

if(!$_GET["action"]){
   $_GET["action"] = "home";
}


basically if action is not set, define it as home.
which happens to be my home page file name....

just thought id share in case anyone else needs a temporary fix until the next version is available.

cheers!


So as it turns out, this method doesnt really work like i though. while inside the forums, the url pat changes to this format: /index.php/board,3.0.html
which seems to cause problems in the navigation.

so i guess ill wait for your next version to be complete. any questimation on when that might be?

thanks for the sweet mod. looking forward to the next version!


Hey just checking in. Hows the progress on the site integration mod coming?

Also,
Im starting to think about SEO friendly URLs. have you given any thought to this?
im guessing all it would take is a well crafted .htaccess file using mod_rewrite.

any thoughts on this?


Title: Re: Site integration Mod
Post by: Nathaniel on July 15, 2008, 10:11:39 PM
Quote from: openinteractive on July 15, 2008, 09:52:24 PM
Hey just checking in. Hows the progress on the site integration mod coming?

Also,
Im starting to think about SEO friendly URLs. have you given any thought to this?
im guessing all it would take is a well crafted .htaccess file using mod_rewrite.

any thoughts on this?

Progress has gone well, I released version 1.4 of this Mod about a week ago, and at the moment, (unless I think of some more good features to add) that will the last update for this Mod for a while. Except updating for new versions of SMF, of course. I am now working mostly on a series of other Mods.

In terms of SEO friendly URLS, I haven't really looked into them, but I believe that they would have to be a separate Mod, because otherwise this Mod would start becoming too huge, and if you made internal SMF actions work with a SEO mod, then the Site Integration Mod should be completely compatible, so I don't have any intention of adding any features relating to SEO to this Mod.

The bigger the Mod, the more likelyhood that it will have some clashes with other mods, which has already happend between v1.4 of this Mod and the Simple Portal Mod, because of this I sort of subscribe to the idea that Mods should be as specific to a certain task as possible, without reducing features or functionality of course, just making more mods that have less general features per mod.

Here is one SMF Mod that I found relating to SEO friendly URLS:
http://custom.simplemachines.org/mods/index.php?mod=636 (http://custom.simplemachines.org/mods/index.php?mod=636)

If you want a Mod that does some more for SEO, then maybe you should put a request in the Mod Requests Board?
http://www.simplemachines.org/community/index.php?board=79.0 (http://www.simplemachines.org/community/index.php?board=79.0)
Title: Re: Site integration Mod
Post by: openinteractive on July 16, 2008, 02:35:38 AM
awesome. i must have missed the release.

so the new version lets you define action=home as the default home page?
Title: Re: Site integration Mod
Post by: Nathaniel on July 16, 2008, 02:56:50 AM
Yep, just make sure that you put "home" into the setting for the default home page not "action=home". ;)

That's the main change for the new version, even though there are a few other more minor changes and feature additions.
Title: Re: Site integration Mod
Post by: Nathaniel on July 16, 2008, 08:19:25 AM
Okay, I have created a small demo forum for this mod, which I will build on so that it demonstraites some of the more complicated features.

For those of you than wanted a demo....
http://www.verbtest.com/smf2demo/index.php
Title: Re: Site integration Mod
Post by: openinteractive on July 17, 2008, 02:37:52 AM
you think its safe to upload the new version over my current Site Integration Mod?
(i have made up backup of files/db of course)
just wondering if there might possibly be a complication. i dont want to break the site while users are online...
Title: Re: Site integration Mod
Post by: Nathaniel on July 17, 2008, 02:52:56 AM
It should be fine to install the lastest version of the Mod. It doesn't have any known errors unless you have the Simple Portal Mod and that has a fix in an earlier post, but I would recommend uninstalling the last version first, otherwise you will get errors from having both versions installed at the same time.
Title: Re: Site integration Mod
Post by: Nathaniel on July 17, 2008, 07:00:31 AM
I have also added a demo site for SMF 1.1.5:
http://www.verbtest.com/smfdemo/index.php

At the moment the demo sites are quite simple, I will try to expand them and add some explanations of features within the demo. Any suggestions for ways to demonstrate this mod would be most welcome... ;)

Thank you,
LHVWB
Title: Re: Site integration Mod
Post by: lindaf on July 25, 2008, 02:06:01 PM
This looks like an awesome mod and I can see the potential of integrating my whole site into smf now!!  AWESOME!!

but, I am a bit new to this.  I've installed the mod (in 2.0) and it seems to be working fine.  The problem I have is I have no idea how to modify the menu to include a tab for forum which would take the user to the regular forum. 

can someone help me out and tell me what I need to learn or do to add to and modify my tabs?

thanks
Title: Re: Site integration Mod
Post by: Nathaniel on July 25, 2008, 08:27:28 PM
@lindaf,
Sure, for SMF 2 Beta, all you need to do to alter your tabs, is to change some code in the "setupMenuContext()" function at the bottom of your "/sources/Subs.php" file. There is a huge array of buttons which you can add yours to.

New buttons look like this:
         'action' => array(
            'title' => 'title',
            'href' => $scripturl,
            'show' => true,
            'sub_buttons' => array(
            ),
         ),


I will explain each part of that:
The 'action' bit is used to work out if that is the current button or not, it should be exactly the same as the action which you type into your url to get to the page ie index.php?action=test.
The 'title' bit is just the text which will be shown on the button.
The 'href' is the location that the button will send you to.
The 'show' bit is a permissions, it allows you to make it so that only certain groups will be able to see this button, if you are using it with this mod then you could put something like " 'show' => allowedTo("SiteIntegration:action"),", and it will use the permissions set up for the action that you have created using this mod.
Finally the 'subbuttons' bit allows you to put a list of subbuttons, these are only used if your theme supports the kind of pop-up buttons which the Simple Machines Community Forum has for the 'Profile' button and the 'Messages' button.
Title: Re: Site integration Mod
Post by: lindaf on July 25, 2008, 10:56:39 PM
 :)oh, AWESOME AWESOME!!!  :D Thank you so much... That all makes sense!!  I've been looking for info like that for a long time, I just haven't been very good at figuring out where to find it!! 

Thank you!  I really appreciate your time to tell me that!

I will go and try that!

if you have time, I have 2 more questions..

in the href  how do you write the url?  ie. as the dir smf is installed being a root? or starting with public_htm/dir/dir etc?
ex: would I do this (... => $smf/file_includes/xyz.php)  where smf is under the public_htm, but smf is where the smf forum is stored.

2nd question.  how does one know if their theme supports pop-up buttons?  Those are pretty cool and I would like to use them if I can.  I just use the default theme right now for 1.1.5 and 2.0 beta

Title: Re: Site integration Mod
Post by: Nathaniel on July 25, 2008, 11:09:43 PM
1. The url should be like "http://www.smfdemo.com/index.php (http://www.smfdemo.com/index.php)", although if you are putting a link to an internal action then you can put something like "$scripturl . '?action=blah' ", that will use the url value for your smf install '$scripturl' and then add the action part of the url onto the end of it.

2. The default theme for both versions does not support pop-up buttons. Generally with SMF 2 Beta, if a theme supports the pop-up buttons then you will be able to see them when you view the theme for the profile section and etc, because they declared for those areas by default, but the theme has to be able to show them. I have not worked with themes very much, but I am sure that if you ask in the Graphics and Template Forum (http://www.simplemachines.org/community/index.php?board=34.0), somebody will be able to help you with that if you want to add it to the theme.

Also note that SMF 1.1.5 has a different system for changing the Menu stuff, you actually have to manually edit the 'template_menu()' function from the 'index.template.php' file.
Title: Re: Site Integration Mod
Post by: lindaf on July 25, 2008, 11:48:04 PM
ahh... ok.. that is good info especially about the 1.1.5..  I have I lot to figure out yet!!  :D ;D  thanks!!!

back to adding that button..  what I am trying to do is have the home button use the site integration mod where I will add a bunch of pages etc..  I can get that to happen by putting home in site integration menu --Forum Default/Home Action.  But then I have no forum..  So I am trying to add a button after home that says forum and have the forum show up.

I went to the subs.php file and I added this after the home button:  (in 2 beta)

'forum' => array(
'title' => $txt['forum'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),


but it didn't do anything, no extra menu choice that says forum.  So I am thinking that I didn't do it right!  ::)  What did I do wrong?
Title: Re: Site Integration Mod
Post by: [unplugged] on July 25, 2008, 11:52:09 PM
Try this instead for the title:

'title' => 'Forum',
Title: Re: Site Integration Mod
Post by: Nathaniel on July 25, 2008, 11:53:41 PM
@lindaf,
Exactly what SunKing put, unfortunately there is no $txt['forum'] value.
Also remember that you should "clear your file cache", the option is in the forum maintenance section.

You might also want to put

'href' => $scripturl.'?action=forums',

if your forums tab is not your home action anymore.
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 12:03:30 AM
I'm getting close!!!  8) ;D   

'Forum' gave me a Forum tab!!

I cleared the cache (thanks for telling me where it was!!)

the action is wrong though cuz it doesn't do anything and have no highlight on it when I click on it.

oh, btw...that $txt came from the code that was already there all the other buttons have it for some reason. (I copied and pasted the code from the home button and then changed what I knew) haha  ;D


p.s.  oh no!! I caught an evil llama and lowered my karma by -3...  oh.. I hope that is not a bad sign for being able to get this to work!!  ;D :D 8) :P
Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 12:09:55 AM
Yeah, the $txt['home'] bit is referring to a SMF language string, they allow you to define the same variable in a whole series of language files so that if you have more than one language, the $txt['home'] variable will return different strings based on your current language. http://huw.org.uk/smfstrings/

Hmm, in terms of the forum button not working, you will have to make sure that you have set the 'href' to $scripturl.'?action=forum'. I posted the wrong thing, 'forum' not 'forums'. Sry. ;)
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 12:20:58 AM
yes!!!..  It works!!! :D ;D 8) :P :)

.........and who said those llama's were evil!!! ;D ;D


I hadn't put anything after $scripturl,

put what you said and it works beautifully!!!  B E A utiful!!!!  (from Bruce Almighty)

Thank you guys so much!!!  This is awesome!!!

Now one last question..  After I play with this, I will want to do this on the forum that is 1.1.5 which is a live forum.  So I will install the mod on that forum, but then when making the forum button, as you mentioned earlier there is a different procedure I have to go through to get the forum button to show and work on the 1.1.5 forum??



Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 12:27:44 AM
Yep, its much more annoying, You will start to love SMF 2 Beta after a while. ;D

You need to make some edits to the 'template_menu' function from your '/themes/{current theme}/index.template.php'. You have to actually have to perform some edits, here they are because I'm nice:

Replace:

    // Work out where we currently are.
    $current_action = 'home';


With:

     // Work out where we currently are.
     $current_action = 'home';
    // Add the stuff for the 'forum' action.
    if($context['current_action'] == 'forum')
         $current_action = 'forum';


Find:

     // Show the [home] button.
    echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                <td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
                    <a href="', $scripturl, '">' , $txt[103] , '</a>
                </td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';



Add after:

      // Show the [forum] button.
    echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
                <td valign="top" class="maintab_' , $current_action == 'forum' ? 'active_back' : 'back' , '">
                    <a href="', $scripturl, '?action=forum">Forum</a>
                </td>' , $current_action == 'forum' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 12:37:31 AM
oh yes!!  YOU ARE NICE!!  Thank you very much for being nice!!!  I really appreciate it!! I'm so excited, I may stay up tonight and keep working on this!!  ;D :D :) 8)

hey, when I add my files to the file_includes folder, can I add directories?  ie. file_includes/articles and then put a bunch of files in articles which I will call from the page I display under the home tab or do I have to put them all in file_includes?

ok.. I'll stop asking questions!!!!


Thank you very very much for all your help!!!
Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 12:43:46 AM
You can have as many sub directories as you like, but the mod won't include the files in them unless you specify the sub directory in the folder includes setting, so you can put into something like "file_includes, file_includes/articles", into the setting to get it to load files from both folders.
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 12:50:56 AM
oh yes!! This is a great night!!!! ;D :D  it works too, it picked up all the files!!!! :D ;D :)

by any chance in the folder includes does it recognize ..   to go up a folder?? i.e.      ../images   ?  (I might be pressing my luck on that one eh!!)  :D ;D
Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 12:56:06 AM
I think that you are referring to the location of any relative images or etc. that are used from one of the included actions.

As per the documentation on the download page:
"Also be aware that when you view your page it will be treated as if it is at the root of your SMF directory, because of the integration. This will effect any relative locations which you are trying to use."

This means that any images or links will be treated as if they are in the index.php page for your smf install, because of them being included they are now at the index.php file.
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 01:30:29 AM
ahh ok!!

Thank you very much for all your help!!!  You really are nice!! ;D :D 8)

Have a wonderful evening!  Maybe you can catch a nice or good llama tonight!

I learned some good things tonight!!!  Still have a lot more to learn, but made a good dent tonight, thanks to you!!

Thanks again!   :) :D ;D
Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 01:37:10 AM
Glad I could help. :D

I've been catching lots of Llamas but I keep on getting evil ones so my Karma is only about 20.

Anyway this thread should probably go back on topic.... ;)
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 05:47:06 AM
oops  :( found one problem..  the navagation links don't take me to the correct spot on the forum instead it takes me to the home page.

ie. Main board/category/board name

clicking on any of the above takes the user to the home page and not the respective board.

any ideas? :D
Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 05:51:13 AM
You mean the link tree, like "Home > Category > Board > Topic"?

The home and category links won't work, I should really try to fix that, gimme a sec... ;)
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 05:59:06 AM
yeah!! ;D :D  You said it exactly! Someday I will learn how to talk efficiently!  8)
Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 06:29:53 AM
Okay, here are some instructions for fixing that problem. I will think about updating the mod sometime to fix this issue, although its not a priority.

Open up your 'Load.php' file from your 'sources' directory.

This edit will make the category link work properly.
Replace this code (line 656):
        // Build up the linktree.
        $context['linktree'] = array_merge(
            $context['linktree'],
            array(array(
                'url' => $scripturl . '#' . $board_info['cat']['id'],
                'name' => $board_info['cat']['name']
            )),
            array_reverse($board_info['parent_boards']),
            array(array(
                'url' => $scripturl . '?board=' . $board . '.0',
                'name' => $board_info['name']
            ))
        );


With this:
        // Build up the linktree.
        $context['linktree'] = array_merge(
            $context['linktree'],
            array(array(
                'url' => $scripturl . '?action=forum#' . $board_info['cat']['id'],
                'name' => $board_info['cat']['name']
            )),
            array_reverse($board_info['parent_boards']),
            array(array(
                'url' => $scripturl . '?board=' . $board . '.0',
                'name' => $board_info['name']
            ))
        );


Only perform the edit below, if you want the first linktree element to point to your forum instead of your Site Integration Home.

Replace this code (line 1360):
    // Set the top level linktree up.
    array_unshift($context['linktree'], array(
        'url' => &$scripturl,
        'name' => &$context['forum_name']
    ));


With this:
    // Set the top level linktree up.
    array_unshift($context['linktree'], array(
        'url' => $scripturl . '?action=forum',
        'name' => &$context['forum_name']
    ));;
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 08:14:42 AM
it was at line 713 in my load.php... hoping that is ok, I went ahead and made the changes.

and Yes!  It works!  Thank you again!! ;D :D

Title: Re: Site Integration Mod
Post by: Nathaniel on July 26, 2008, 11:25:39 PM
That was definitely the right thing to do, you might have installed some mods so that's probably the reason for the different locations, as I had checked it on a clean version of SMF.

Edit: Woot! This mod reached 1000 total downloads. :D
Title: Re: Site Integration Mod
Post by: lindaf on July 26, 2008, 11:36:04 PM
cool!! 8)  Congratulations! 
Title: Re: Site Integration Mod
Post by: ipoco on August 04, 2008, 10:14:51 AM
This is a terrific mod.

One little question . . .

One of the php pages I need to use this on includes an swf (flash) which requires:

<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>



<script language="javascript">
   if (AC_FL_RunContent == 0) {
      alert("This page requires AC_RunActiveContent.js.");
   } else {
      AC_FL_RunContent(
         'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
         'width', '1000',
         'height', '1000',
         'src', 'ipocoapp',
         'quality', 'high',
         'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
         'align', 'middle',
         'play', 'true',
         'loop', 'true',
         'scale', 'showall',
         'wmode', 'window',
         'devicefont', 'false',
         'id', 'ipocoapp',
         'bgcolor', '#f3e7cd',
         'name', 'ipocoapp',
         'menu', 'true',
         'allowFullScreen', 'false',
         'allowScriptAccess','sameDomain',
         'movie', 'ipocoapp',
         'salign', ''
         ); //end AC code
   }
</script>

The above code is already in the php page I want to open - as above - however when I open it using: ...index.php?action=ipocoapp I get the "this page requires AC_RunActiveContent.js" message ( which I don't get if I open the page outside of smf.)

If I want to run this page (which I do), where do I put the above code?

Thanks!

C
Title: Re: Site Integration Mod
Post by: Nathaniel on August 04, 2008, 05:33:11 PM
@ipoco,
I am glad that you like it. In terms of getting your javascript script to work, I am not totally sure because I haven't worked with much javascript, but you could try to add something like the code below to your 'template_main_above()' function in your 'index.template.php' file.


if($context['current_action'] == 'ipocoapp')
echo '
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>';
Title: Re: Site Integration Mod
Post by: ipoco on August 04, 2008, 07:47:00 PM
 ;D  I added the below to index.template.php along with the other js calls that were there and it works perfectly.

   <script language="javascript">AC_FL_RunContent = 0;</script>
   <script src="AC_RunActiveContent.js" language="javascript"></script>
Title: Re: Site Integration Mod
Post by: sinnie on August 04, 2008, 10:01:04 PM
Ok I am having some issues with the mod. I did all the changes listed here:
http://custom.simplemachines.org/mods/index.php?action=parse

and I uploaded the loadfile.php and the SiteIntegration.template.php

When I go to the main page it says
An Error Has Occurred!
Unable to load the 'main' template.

I also have no idea how to include MY sites header and footer. Please help.

This is also the link to the site, so you can see the error in real time.
http://writerslair.net/smf/index.php

Also I just noticed that all the links for the forums are completely messed up. Ugh I guess I completely ruined something  >:(
Title: Re: Site Integration Mod
Post by: Nathaniel on August 04, 2008, 10:18:44 PM
Okay, something has gone really wrong. Do you have any other mods on your site?

Firstly, did you try to automatically install this mod through the package manager? Because it should work, especially on a new install of SMF. If you hadn't tried to install it through the package manager, then I recommend that you copy clean versions of the files that you edited from an uninstalled copy of SMF, and copy them over the ones that you made changes to.
You will then be able to use the package manager to upload and install the mod.
Package Manager (http://docs.simplemachines.org/index.php?board=49.0;sort=subject)

Secondly if that is not an option, then can you please post your index.php file so that I can check that you have made the changes to that file correctly?
Title: Re: Site Integration Mod
Post by: ipoco on August 04, 2008, 10:27:56 PM
Another quick question.

When I open an "outside" php page using this mod - it is placed in a nice css? box with a hairline boarder around it.  The background color of the box defaults to white.  I'd like to set it to the grey used in the default template.  I 'think' the setting is somewhere in style.css but am not sure where.

Thanks again in advance

C
Title: Re: Site Integration Mod
Post by: [unplugged] on August 04, 2008, 11:32:26 PM
The way I did mine to make it "integrate" more to my liking was to open SiteIntegration.template.php and change:
function template_SiteIntegration()
{
global $context;
// Show a display box for the included page.
echo'
<div class="tborder" style="margin-top: 1ex;">
<div style="padding: 2ex;" id="helpmain">
';

// Include the page.
require_once($context['file_include']);

// End the display box.
echo '
</div>
</div>
';
}


to this:
function template_SiteIntegration()
{
global $context;

// Show a display box for the included page.
echo'<div>';

// Include any of the language files, that need including, doing it here allows the admin to do some kind of dodgy stuff if they really want to.

foreach($context['language_includes'] as $file)

require_once($file);

// Include the page.
require_once($context['file_include']);

// End the display box.
echo '</div>';
}


Then I added some stylings to the beginning of my include files to incorporate the current theme.
I think it just makes this great mod look better. You can see what I mean by CLICKING HERE (http://www.empireofthesun.net/forum/index.php?action=demo;).

I've also attached the "template" I use for my include files to achieve this. Hope this helps.
Title: Re: Site Integration Mod
Post by: Kylezz on August 04, 2008, 11:48:41 PM
Nice job. Installing now.
Title: Re: Site Integration Mod
Post by: sinnie on August 05, 2008, 01:13:13 AM
LH, I don't have any other mods. I did what I guess is manual install because I wasn't aware of a package manager.

I just reinstalled SMF and used the package manager and installed it correctly. Now how do I edit the header and footers and/or implement it with my site exactly??
Title: Re: Site Integration Mod
Post by: Nathaniel on August 05, 2008, 02:07:02 AM
@ipoco,
Like SunKing suggested, you can open up and change the 'SiteIntegration.template.php' file, as I have said before, I am not particularly good with making templates look good, so its relatively easy to change how it looks through that template file.

@Kylezz,
Thanks, I'm glad you like it! :D

@sinnie,
Like I said to ipoco, if you just want to change the box which it contains your pages in, then you can do that in the 'SiteIntegration.template.php' file, if you want to change the actual headers and footers for your entire website then you need to edit the 'template_main_above()' and 'template_main_below()' functions from your themes 'index.template.php' file.

As a note, the 'SiteIntegration.template.php' file, will only be in your default themes, if you change that template it will change it for all themes. If you wish to change it differently for each theme, then you can make a copy of that file in your custom theme's folders and then edit it.
Title: Re: Site Integration Mod
Post by: sinnie on August 05, 2008, 02:54:34 PM
So if I edit index.template.php will that make the changes for each page for the forum?

I've been playing around with the CSS stuff, changing colors but I can't seem to find a way to get rid of the last bit of blue-ness. Anyone know where this stuff is??

Here's a link so you can see.

http://www.writerslair.net/smf

Until then I guess I'm stuck with some blue. If you look closely when you reload it it IS the correct color, but then it reverts back to blue somehow. Any clue on how to fix it?

Thanks for the mod though!
Title: Re: Site Integration Mod
Post by: Nathaniel on August 05, 2008, 06:58:37 PM
@sinnie,
Those blues that you can see are images. You can look for css code like "url(web location)" in your style.css file to change the images you use. But there is more to it, I suggest that you ask about it in the Graphics and Template forum (http://www.simplemachines.org/community/index.php?board=34.0).
Title: Re: Site integration Mod
Post by: dwd2000 on August 15, 2008, 12:48:01 AM
Quote from: LHVWB on June 08, 2008, 06:08:29 AM
This mod is not designed to integrate entire software packages into SMF, so it may have some odd results...

This is what I was hoping this mod would do.
I have a "website promotion" site which has or will have several scripts to help promote websites.
(web ring, banner exchange, link exchange, etc.)
The development of the site is taking a backseat because I'm working on one of my other sites which is now using SMF.

Are there any plans for this type of integration?
Maybe it would be easier to request separate mods for each type of script?
Title: Re: Site Integration Mod
Post by: Nathaniel on August 15, 2008, 02:13:38 AM
@dwd2000,
It really depends on how huge the scripts are, if you are talking about integrating a script that normally requires its own folder on your website, and has 40 or more parts to it, such as a forum, CMS, or etc. then it probably wouldn't work. It also depends, if you are using your own member system with the scripts, or if you want to use the SMF member system. However, if you are merely trying to integrate a few relatively small scripts then it should be possible.

If you are trying to integrate huge scripts then you should ask about them in this forum:
http://www.simplemachines.org/community/index.php?board=33.0
Title: Re: Site Integration Mod
Post by: dwd2000 on August 15, 2008, 02:40:37 AM
Quote from: LHVWB on August 15, 2008, 02:13:38 AM
@dwd2000,
It really depends on how huge the scripts are, if you are talking about integrating a script that normally requires its own folder on your website, and has 40 or more parts to it, such as a forum, CMS, or etc. then it probably wouldn't work. It also depends, if you are using your own member system with the scripts, or if you want to use the SMF member system. However, if you are merely trying to integrate a few relatively small scripts then it should be possible.

If you are trying to integrate huge scripts then you should ask about them in this forum:
http://www.simplemachines.org/community/index.php?board=33.0

Yes, each script has its own folder.
No, it's not like a CMS.
I would use the forums that are included with SMF.
If it's possible, I would use the SMF membership system.
Script examples:
Banner exchange, link exchange, web ring, etc.

Each script has it's own CSS, etc., so I could see that as a problem. (unless I want to go through every script and make the changes)

I have also posted this as a mod request, hoping someone might develop website promotion mods for SMF.

Thanks for your reply.
Title: Re: Site Integration Mod
Post by: xyber9 on August 15, 2008, 04:13:18 PM
I'm sorry, but I'm still not understanding how this mod works  :(
I've installed the package into my site, but I don't know where to begin modifying stuff. or rather, "what" to modify.
Please if anyone doesn't mind helping me I'd be very appreciative :)
Thanks in advanced.

xyber9
Title: Re: Site Integration Mod
Post by: Nathaniel on August 15, 2008, 08:47:26 PM
@dwd2000,
It should be possible, you will just need to do some work on it.

@xyber9,
First thing you need to do, is to add a "File Include Folder" to the setting in the admin area, then you will need to add some files to it so that they are included as actions. Remember that this mod, will include your files, as actions in SMF. So that you can access them at "index.php?action=blah", if the included file was called blah.php, blah.html or etc.
Title: Re: Site Integration Mod
Post by: xyber9 on August 16, 2008, 01:16:42 AM
Thanks for the reply :) I think I'm understanding a little better now, so say I want to add games to my site, I create a File/Action Include Folders named "GAMES" and in Extra "File/Action Include" File Extensions i put the name of the php, htm etc. file. Is this correct? :)
Title: Re: Site Integration Mod
Post by: Nathaniel on August 16, 2008, 01:32:32 AM
No, in the "Extra "File/Action Include" File Extensions" setting, you can put the file extensions, like '.html', '.txt', '.me', '.doc' and etc. By default, the mod will include all '.php' files from the folders that you specify, however if you want to use .html or .htm or etc, you will have to add them to the setting.

The mod will automatically include the files, then you can manage them within the admin area. Remember that you will need to change the permissions for each included file/action (by clicking on the manage link next to each included file/action), before anybody apart from the admin will be able to see them. ;)
Title: Re: Site Integration Mod
Post by: xyber9 on August 16, 2008, 02:37:59 AM
I see. Wow It's working well! I think I'll change my complete site into a board! In fact, that's what I'm doing now, lol ,sorry for not posting sooner. :-[ Ok one more question, is there a way to center the extension, or can it only be aligned to the left? If it's simply changing the html I know how to do that, but still learning php, oh and the extension is in html.
Title: Re: Site Integration Mod
Post by: Nathaniel on August 16, 2008, 03:50:11 AM
Well, if you know where to look. You can actually completely remove the box that the mod puts around the pages/files that are included.

The file you will need to edit is the "themes/default/SiteIntegration.template.php" file, you want to edit the "template_SiteIntegration()" function, the code you will need to edit, looks like this:
function template_SiteIntegration()
{
   global $context;
      //   Show a display box for the included page.
   echo'
   <div class="tborder" style="margin-top: 1ex;">
      <div style="padding: 2ex;" id="helpmain">
      ';

      //   Include the page.
      require_once($context['file_include']);
     
   //   End the display box.
   echo '
      </div>
   </div>
   ';
}


To align the contents of the included pages/files left, you can replace the code above with this code:
function template_SiteIntegration()
{
   global $context;
      //   Show a display box for the included page.
   echo'
   <div class="tborder" style="margin-top: 1ex;">
      <div style="padding: 2ex;text-align:center;" id="helpmain">
      ';

      //   Include the page.
      require_once($context['file_include']);
     
   //   End the display box.
   echo '
      </div>
   </div>
   ';
}


Please note that changing the html like that, by adding "text-align:center;" to that function will alter how every one of your pages is shown, you could also just use code like this, and have a slightly different box in each included page/file.
function template_SiteIntegration()
{
    global $context;

       //   Include the page.
       require_once($context['file_include']);
       
}
Title: Re: Site Integration Mod
Post by: xyber9 on August 17, 2008, 05:01:17 PM
Ok, nice   it's working. :D Everything seemed to be going good until this morning when I logged on to my site under a different name just to test the board, and I can't open some of the links, they just send me back to the index. I've attempted to change the permissions through the Site Integration tabs, but when I go back to change the permissions and save them they just stay the same. :( Two of the links allow me to change the permissions, but the rest won't save the changes. While I'm not sure why this is I was just wondering if there was a way to change the permissions manually through the SiteIntegration.template.php or something like that? Oh and I have change the permissions of the files themselves manually, I put everything on 777 thinking that it would allow users to see the files, but it still doesn't. So I'm pretty much lost now, lol.   :-\
Title: Re: Site Integration Mod
Post by: Nathaniel on August 17, 2008, 05:25:00 PM
Firstly, which version of SMF do you have?

There is no way to save the changes through the 'SiteIntegration.template.php' file, the permissions are done through the mod and should work. ;)

The only suggestion that I can make, is that when you click manage for a particular file/action, and then change the permissions checkboxes for it, you have to click the 'Save' button as opposed to going "Back To General Settings", because otherwise it shouldn't save.

If you can tell me your version and maybe any other mods you have installed, then I should be able to investigate it.
Title: Re: Site Integration Mod
Post by: xyber9 on August 17, 2008, 05:52:40 PM
Thanks for replying :)
I'm currently using smf 1.1.5 and these are the only mods I'm using:
1.     Skype Integration      1.0
2.     Ultimate Profile      0.8.5
3.     Site Integration Mod      1.4
Everything else seems to be working well, just the saving part, you can look at the site here:
http://2liveonline.com  (http://2liveonline.com)
:D
Title: Re: Site Integration Mod
Post by: Nathaniel on August 18, 2008, 02:47:49 AM
Hmm, none of those mods should be effecting how the Site Integration Mod works, did you have any install errors when you installed the mod? Are there any errors in your error log?
Forum Error Log (http://docs.simplemachines.org/index.php?topic=150)
Title: Re: Site Integration Mod
Post by: xyber9 on August 18, 2008, 03:24:23 AM
 :D :D :D :D
lol! I found the problem (and solution!!!)
I've just checked the error log like you told me and I had like 100 errors in just a couple of days. A few were from other logs, but the bulk of the logs were for "SiteIntegrationMod_tab_heading" found in "/Sources/ModSettings.php" on Line: 138 (which is probably different from everyone.) I remember you saying that there was nothing to change internally, then I began looking at my links... The two links working for everyone were single word links, while the others that weren't working had three words in them per link i.e.=
GAMES.html WORKS FINE but GAME SECTION.html didn't work at all. So I put two and two together (not by my own power mind you) and remembered from years ago that without an underscore the links in php wouldn't work, lol nice timing hugh? Anyway I combined the words and viola! All the links work! :D  :D So I'm good to go now, with a relieved mind ready to officially run my site (I've had so many unofficial releases in the past that it's sad!)
So THANK YOU!!! For taking out time to help me out. GOD most definitely had you here for mea!!!
;)  2liveonline.com (http://2liveonline.com) is Fully Functional And Ready 2 go!!!
Title: Re: Site Integration Mod
Post by: Nathaniel on August 18, 2008, 03:26:53 AM
@xyber9,
Glad to hear it.

I had actually come accross that problem before, but its a difficult one to diagnose. Nice work! :D

I'll try to add a note about that to the documentation so that it doesn't happen to anyone in the future.

Good luck with the site. ;D
Title: Re: Site Integration Mod
Post by: xyber9 on August 19, 2008, 02:40:16 AM
Thanks! I guess we both learned something (*scratches head still confused a little)
:D
Of course you helped me out waaaay more, I just fiddled around a little, lol
But thanks!  :D
I've got high expectations outta the site, and with GOD on my side... nothing is impossible!

I just believe it!  :D :D :D
Title: Re: Site Integration Mod
Post by: Panache Web on August 30, 2008, 11:48:40 PM
so how would I make it so it does not say unknown action on the who's online list?

Title: Re: Site Integration Mod
Post by: Nathaniel on August 31, 2008, 02:05:26 AM
@dcd119,
Step by Step method:
1) Put a string into the 'Language String Prefix' setting, something like 'site_'.
2) Check the 'Show in Whosonline list?' setting for each included file/action that you want to be shown.
3) Add a '$txt['site_{Title of Included action.file}']' string for every included file/action that you want to add. You have to add your own language strings into the $txt variable. You can do this either by adding them into your 'modifications.english.php' file at the beginning, or by creating your own language files (see the 'Language File Include Folders' setting).

Example:
You have three included actions with the titles 'home', 'demo' and 'evil'. You have set the 'Language String Prefix' setting to 'site_'.

$txt['site_home'] = 'Home';
$txt['site_demo'] = 'Demo';
$txt['site_evil'] = 'Mahahahaha';


I hope that that explanation makes it clear enough, if not then I can help you with anything that you didn't understand. ;)
Title: Re: Site Integration Mod
Post by: Panache Web on September 01, 2008, 03:58:42 AM
I am getting this error, I am not sure what it is from.

Duplicate entry '18-SiteIntegration:rosteraddmembe' for key 1
File: /home/ggate/public_html/Sources/ManagePermissions.php
Line: 1819

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0 Beta 3.1 Public, while your database is at version 2.0 Beta 3 Public. The above error might possibly go away if you execute the latest version of upgrade.php.

should I overrwrite all the core files?
Title: Re: Site Integration Mod
Post by: Nathaniel on September 01, 2008, 04:04:07 AM
Not sure about that error, its possible that you tried to add a file/action include with the same name as one that is already in the system (although that shouldn't have caused any errors). I will have a look into it. You shouldn't have to overwrite any source files. ;)

Just a few questions: ;)
Which version of SMF do you have?
Where are you receiving that error?
Title: Re: Site Integration Mod
Post by: dwd2000 on September 01, 2008, 03:55:23 PM
Quote from: dwd2000 on August 15, 2008, 02:40:37 AM
Quote from: LHVWB on August 15, 2008, 02:13:38 AM
@dwd2000,
It really depends on how huge the scripts are, if you are talking about integrating a script that normally requires its own folder on your website, and has 40 or more parts to it, such as a forum, CMS, or etc. then it probably wouldn't work. It also depends, if you are using your own member system with the scripts, or if you want to use the SMF member system. However, if you are merely trying to integrate a few relatively small scripts then it should be possible.

If you are trying to integrate huge scripts then you should ask about them in this forum:
http://www.simplemachines.org/community/index.php?board=33.0

Yes, each script has its own folder.
No, it's not like a CMS.
I would use the forums that are included with SMF.
If it's possible, I would use the SMF membership system.
Script examples:
Banner exchange, link exchange, web ring, etc.

Each script has it's own CSS, etc., so I could see that as a problem. (unless I want to go through every script and make the changes)

I have also posted this as a mod request, hoping someone might develop website promotion mods for SMF.

Thanks for your reply.

Tried integrating the scripts, but was very complicated. The main page for the script would work great, but the internal links for the script wouldn't. I think I would have to change all the internal links to "action=whatever" and incorporate each section into the integration. I read an earlier post where you suggested using iframes. Tried it and works great. The only downfall is that people need to sign into each section separately. I can live with that.

If anyone wants to look: http://www.ultimatewebring.com
I've added a web ring, link exchange, and a plug board to the site. (so far)

OOOOPS - Forgot to set permissions for guests, etc. It's done now.
Title: Re: Site Integration Mod
Post by: Dret on September 09, 2008, 11:57:48 PM
Hi to all...

I saw the new version of this fantastic Mod (settings for permissions in easy way!!)....

But... don't seems actually working on new 1.1.6...!!!  :( :-[

Is planned an upgrade... in short time??

Thanks a lot...!!
Bye!

Dret.
Title: Re: Site Integration Mod
Post by: Nathaniel on September 10, 2008, 01:24:26 AM
@dwd2000,
It looks good. :)

@Dret,
I have now updated it for SMF 2 Beta 4.0 and SMF 1.1.6, it should now install properly.
Title: Re: Site Integration Mod
Post by: steph1987 on September 11, 2008, 03:19:11 AM
If anyone could help me with this it would be greatly appreciated

The mod works fine, absolutely fantastic mod and gives me the chance to create everything i want.....but

as soon as i log off admin and i go to guest status, i cant access those pages, im running the musiconica theme

I want to make it so all pages can be accessed by guests/mods/admin/whoever

I know u have to insert or modify some sort of code but i dont understand it well, is there a simple code i can paste somewhere, or search for something and change it?

thanks again, and congrats to the author for making the best smf mod around
Title: Re: Site Integration Mod
Post by: Nathaniel on September 11, 2008, 03:31:44 AM
@steph1987,
Have you set-up the 'Permissions' setting for your Included Files/Actions in the admin area? If you click on the 'manage' link next to each file/action then you can change the permissions, by default only admin can view included files/actions.
I am glad that you like the mod. :)

Title: Re: Site Integration Mod
Post by: steph1987 on September 11, 2008, 03:59:10 AM
found the problem, it doesnt like my spaces, ive got thousands of pages all with links with spaces in it. Theres no possible way to change permissions on names with spaces is there?? or make every file default to guests being able to view it instead of just admin?
'
Title: Re: Site Integration Mod
Post by: Nathaniel on September 11, 2008, 04:16:43 AM
No, not easily. The reason that it doesn't allow spaces in included file/action names, is because the $_POST method doesn't support them.

This edit should work:
Find this code ('sources/LoadFile.php'):
   //   Check permissions before we even load anything.
   if(!allowedTo("SiteIntegration:".$context['current_action']))
   {
      //   If they are a guest then show a login screen.
      if($user_info['is_guest']
      //   Also make sure that the correct setting has been check to enable redirecting of guests to a login screen.
      && isset($modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      && $modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      {
         //   Show the login page.
         require_once($sourcedir."/LogInOut.php");
         Login();
         //   Set the url so that when the user logs in, they will be redirected back to the correct action.
         $_SESSION['login_url'] = $boardurl . "/index.php?action=".$context['current_action'];
      }
      //   Other wise they are a member and we will send them to the setable permissions error page.
      elseif(isset($modSettings['SiteIntegrationMod_failed_permissions_action']))
         redirectexit("action=".$modSettings['SiteIntegrationMod_failed_permissions_action']);
         
      //   Can't be bothered mucking around with this scumbag, send them straight to the board home.
      else
         redirectexit();
     
      //   Break this function to avoid any annouying errors.
      return false;
   }


Replace with this code:
/*   //   Check permissions before we even load anything.
   if(!allowedTo("SiteIntegration:".$context['current_action']))
   {
      //   If they are a guest then show a login screen.
      if($user_info['is_guest']
      //   Also make sure that the correct setting has been check to enable redirecting of guests to a login screen.
      && isset($modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      && $modSettings['SiteIntegrationMod_badpermissions_guestlogin'])
      {
         //   Show the login page.
         require_once($sourcedir."/LogInOut.php");
         Login();
         //   Set the url so that when the user logs in, they will be redirected back to the correct action.
         $_SESSION['login_url'] = $boardurl . "/index.php?action=".$context['current_action'];
      }
      //   Other wise they are a member and we will send them to the setable permissions error page.
      elseif(isset($modSettings['SiteIntegrationMod_failed_permissions_action']))
         redirectexit("action=".$modSettings['SiteIntegrationMod_failed_permissions_action']);
         
      //   Can't be bothered mucking around with this scumbag, send them straight to the board home.
      else
         redirectexit();
     
      //   Break this function to avoid any annouying errors.
      return false;
   }
*/


Please note, that by commenting out that code (you could remove it as well), you are allowing anyone to see any of your included pages, no matter their permissions.
Title: Re: Site Integration Mod
Post by: steph1987 on September 11, 2008, 04:29:11 AM
Wow it worked, im jumping up and down. Wooohooooooooooo

Thank you soooo much, i mean u really went out of ur way to help me, im very thankful :)
Title: Re: Site Integration Mod
Post by: Dret on September 12, 2008, 12:49:43 AM
Quote from: LHVWB on September 10, 2008, 01:24:26 AM
@dwd2000,
It looks good. :)

@Dret,
I have now updated it for SMF 2 Beta 4.0 and SMF 1.1.6, it should now install properly.

Thanks a lot....!!
Bye.

Dret!
Title: Re: Site Integration Mod
Post by: omsharma on September 14, 2008, 01:56:54 AM
i am using ur mod. it worked well upto integrating the external webpages. but my problem starts here.
i want to integrate a web form that allows uploading files to server either by normal client upload or via http fetch and also it should be only accessible to global moderators. i hav integrated the script files. but when im trying to upload the files, it fails to upload. plz tell me whether its possible to use this form using this mod or not. i hav also chmod the upload folders with full permission.
Title: Re: Site Integration Mod
Post by: Nathaniel on September 14, 2008, 02:11:19 AM
@omsharma,
I am not sure about that issue. I can't think of any reasons why a script like that wouldn't work within SMF, because I don't now anything about the script that you are trying to use.

I can only recommend that you make sure that any urls are correct for your forum and that your script works fine outside of SMF. I may be able to help fix the issue if you can post your code.

About the permissions, make sure that you have set them up in the admin area. You should be able to do it for each membergroup when you manage the included file/action.
Title: Re: Site Integration Mod
Post by: omsharma on September 14, 2008, 03:38:33 AM
one more problem i hav. when i open that integrated page it shows the full directory structure. how can i avoid my script from showing the full directory structure.... i hav kept my index.php and httpup.php files inside a folder named "rapid" inside smf root directory.
Title: Re: Site Integration Mod
Post by: Nathaniel on September 14, 2008, 04:17:48 AM
You can put in place a 'dummy', 'index.php' or 'index.html' file so that they can't view the directory structure of the folder. If you want, you can copy the 'index.php' file from your 'sources' directory, which should try to redirect them back to your forum.

You can also put this code at the start of those files, to stop them from being accessed from outside of SMF:
<?php
if (!defined('SMF'))
  die(
'Hacking attempt...');
?>


Your issue may be that this mod won't add any files called 'index.php' to its list of included action/files so they won't be added. Try renaming them, if this is the issue.
Title: Re: Site Integration Mod
Post by: GamersGoop on September 24, 2008, 12:28:59 AM
I must be dumb... But I can't find the code anywhere...

What code would I put into one of my php files to display "online users, online today, online now" on one of them? Kind of like TinyPortal has.

Thanks, and keep up the good work.
Title: Re: Site Integration Mod
Post by: Nathaniel on September 24, 2008, 12:36:55 AM
The code below should work, although it has more fields than you want. If you want to edit the appearance then you can edit the outputed html code near the bottom. I can help you if you can give me a more detail explanation of what you want.

<?php
 
global $scripturl, $db_prefix, $user_info, $txt, $settings, $online, $modSettings;

 
$result = db_query("
     SELECT
        lo.ID_MEMBER, lo.logTime, lo.url, mem.realName, mem.memberName, mem.showOnline,
        mg.onlineColor, mg.ID_GROUP
     FROM
{$db_prefix}log_online AS lo
        LEFT JOIN
{$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
        LEFT JOIN
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

 
$online['users'] = array();
 
$online['guests'] = 0;
 
$online['hidden'] = 0;
 
$online['buddies'] = 0;
   
$online['spiders'] = array();
 
$online['num_spiders'] = 0;  
 
$show_buddies = !empty($user_info['buddies']);

  while (
$row = mysql_fetch_assoc($result))
  {
     if (empty(
$row['realName']))
     {
       
// Get the request parameters..
       
$actions = @unserialize($row['url']);
       
       
// Is a spider?
       
$is_spider = ob_googlebot_getAgent($actions['USER_AGENT'], $spider_name, $agent);
       
        if (!
$is_spider)
           
$context['num_guests']++;
        else
        {
           
$context['num_spiders']++;
           
           if (
$modSettings['ob_googlebot_display_agent'])
             
$spider_name = $agent;
           
           if (
$modSettings['ob_googlebot_count_all_instances'] && $modSettings['ob_googlebot_display_all_instances'])
             
$context['spiders'][] = $spider_name;
           else
             
$context['spiders'][$agent] = $spider_name;
        }
       
        continue;
     }
     elseif (!empty(
$row['showOnline']) || allowedTo('moderate_forum'))
     {
       
// Some basic color coding...
       
if (!empty($row['onlineColor']))
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
        else
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

       
// Bold any buddies.
       
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
        {
           
$online['buddies']++;
           
$link = '<b>' . $link . '</b>';
        }

       
$online['users'][$row['logTime'] . $row['memberName']] = array(
           
'id' => $row['ID_MEMBER'],
           
'username' => $row['memberName'],
           
'name' => $row['realName'],
           
'group' => $row['ID_GROUP'],
           
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
           
'link' => $link,
           
'hidden' => empty($row['showOnline']),
           
'is_last' => false,
        );
     }
     else
       
$online['hidden']++;
  }
 
mysql_free_result($result);

  if (!empty(
$online['users']))
  {
     
krsort($online['users']);
     
$userlist = array_keys($online['users']);
     
$online['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
  }
 
$online['num_users'] = count($online['users']) + $online['hidden'];
 
$online['total_users'] = $online['num_users'] + $online['guests'];
 
ksort($online['spiders']);

 
// Allowed user to see spiders online?
 
if (!allowedTo('googlebot_view'))
     
$online['spiders'] = array();
 
 
// Don't count all instances of a spider, only 1 for each different spider
 
if (!empty($context['spiders']) && !$modSettings['ob_googlebot_count_all_instances'])
     
$online['num_spiders'] = count($context['spiders']);
     
 
// Diplay how many instances of each spider
 
if (!empty($online['spiders']) && $modSettings['ob_googlebot_count_all_instances'] && $modSettings['ob_googlebot_display_all_instances'])
  {
     
$spider_grouped = array_count_values($context['spiders']);
     
     
$online['spiders'] = array();
     foreach (
$spider_grouped as $k => $v)
       
$online['spiders'][$k] = $k . ($v == 1 ? '' : ' (' . $v . ')');
  }

     echo
'<table>
     <tr>
        <td><img src="'
. $settings['images_url'] . '/dot.gif" alt="Dot" /></td>
        <td>'
, $txt['sp-onlineguest'], '</td>
        <td>:</td>
        <td>'
, $online['num_spiders'],'</td>
     </tr>
     <tr>
        <td><img src="'
. $settings['images_url'] . '/dot.gif" alt="Dot" /></td>
        <td>'
, $txt['sp-onlineuser'], '</td>
        <td>:</td>
        <td>'
, $online['num_users'],'</td>
     </tr>
     <tr>
        <td><img src="'
. $settings['images_url'] . '/dot.gif" alt="Dot" /></td>
        <td>'
, $txt['sp-onlinehuser'], '</td>
        <td>:</td>
        <td>'
, $online['hidden'],'</td>
     </tr>
     <tr>
        <td><img src="'
. $settings['images_url'] . '/dot.gif" alt="Dot" /></td>
        <td>'
, $txt['sp-onlinetuser'], '</td>
        <td>:</td>
        <td>'
, $online['total_users'],'</td>
     </tr>'
;
           if(!empty(
$online['users']))
           echo
'   <tr>
        <td><img src="'
. $settings['images_url'] . '/dot.gif" alt="Dot" />
        </td><td>'
, $txt['sp-onlineouser'], '</td>
        <td>:</td>
        <td>&nbsp;</td>
     </tr>'
;

     foreach (
$online['users'] as $user)
        echo
'<tr>
              <td colspan="4" style="padding-left: 15px;"><img src="'
. $settings['images_url'] . '/useron.gif" alt="user" /> ',$user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'],'</td>
           </tr>'
;
     echo
'</table>';
?>


That code is taken from the whos_online block from Simple Portal.[/code]
Title: Re: Site Integration Mod
Post by: GamersGoop on September 24, 2008, 01:30:10 AM
I love you! I knew I saw that code before somewhere... I was looking in the default index.template file! Lol.

But yess! That was perfect. Thank you a ton. Keep up the good work. I love your mods.
Title: Re: Site Integration Mod
Post by: GamersGoop on September 24, 2008, 02:30:30 AM
There is one small problem with that code. It doesn't want to show the real guests number online. It stays at 0.
Title: Re: Site Integration Mod
Post by: Nathaniel on September 24, 2008, 04:54:44 AM
I apologise, it appears that I posted a heavily edited version which was meant to show some spiders as well. Try the code below, it should show the correct numbers and the correct titles as well. ;)

<?php
global
$scripturl, $db_prefix, $user_info, $txt, $settings, $online;

$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM
{$db_prefix}log_online AS lo
LEFT JOIN
{$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

$online['users'] = array();
$online['guests'] = 0;
$online['hidden'] = 0;
$online['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);

while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$online['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$online['buddies']++;
$link = '<b>' . $link . '</b>';
}

$online['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$online['hidden']++;
}
mysql_free_result($result);

if (!empty($online['users']))
{
krsort($online['users']);
$userlist = array_keys($online['users']);
$online['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$online['num_users'] = count($online['users']) + $online['hidden'];
$online['total_users'] = $online['num_users'] + $online['guests'];

echo '<table>
<tr>
<td>Guests Online</td>
<td>:</td>
<td>'
, $online['guests'],'</td>
</tr>
<tr>
<td>User Online</td>
<td>:</td>
<td>'
, $online['num_users'],'</td>
</tr>
<tr>
<td>Hidden Users Online:</td>
<td>:</td>
<td>'
, $online['hidden'],'</td>
</tr>
<tr>
<td>Total Users Online:</td>
<td>:</td>
<td>'
, $online['total_users'],'</td>
</tr>'
;
if(!empty($online['users']))
echo ' <tr>
<td>Online users:</td>
<td>:</td>
<td>&nbsp;</td>
</tr>'
;

foreach ($online['users'] as $user)
echo '<tr>
<td colspan="3" style="padding-left: 15px;"><img src="'
. $settings['images_url'] . '/useron.gif" alt="user" /> ',$user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'],'</td>
</tr>'
;
echo '</table>';

?>
Title: Re: Site Integration Mod
Post by: GamersGoop on September 24, 2008, 06:10:12 AM
That is perfectly fine. It works perfectly now. Thank you so much!
Title: Re: Site Integration Mod
Post by: xyber9 on September 24, 2008, 11:40:22 PM
Hey! Check out my site!!! I've used the Site Integration Mod on my site and it has made my site what it is today,

2 LIVE ONLINE!!! (http://www.2liveonline.com)
Title: Re: Site Integration Mod
Post by: Nathaniel on September 25, 2008, 04:05:55 AM
@xyber9,
It looks good. Its great to see that you have successfully used this mod to help build your website. :D
Title: Re: Site Integration Mod
Post by: dwd2000 on September 26, 2008, 12:01:41 AM
Hello. Me again.
I'm using nneonneo's Shoutbox as a chat room via your integration mod. (works like a charm)
I have one request:
Is there any way of showing who is actually viewing it?
I noticed in the Gallery, as well as the boards, it shows who is viewing them.
I have already asked nneonneo's Shoutbox, but they said that it depends on Site Integration.
Personally, I think there should be a way to put the code anywhere you want.

Any ideas?
Title: Re: Site Integration Mod
Post by: Nathaniel on September 26, 2008, 12:56:19 AM
@dwd2000,
As nneonneo said that is related to this mod, you will have to add some code to the included 'chat/shoutbox' file. The topic below discusses doing something similar:
http://www.simplemachines.org/community/index.php?topic=256079.msg1688278#msg1688278 (http://www.simplemachines.org/community/index.php?topic=256079.msg1688278#msg1688278)

Although for your needs the code below should work, just remember to replace 'test' with the correct action that you need to view the list for. ;)
<?php
   
global $scripturl, $db_prefix, $user_info;

   
$action = 'test';
   
   
// Load the users online right now.
   
$result = db_query("
       SELECT
           lo.ID_MEMBER, lo.url, mem.realName, mg.onlineColor
       FROM
{$db_prefix}log_online AS lo
           LEFT JOIN
{$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
           LEFT JOIN
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
       WHERE mem.showOnline != 0
           AND mem.realName != ''"
, __FILE__, __LINE__);

   
$total_count = 0;
   
$users = array();
   
   
//    Go through each user
   
while ($row = mysql_fetch_assoc($result))
   {
       
$total_count++;
       
// Some basic color coding...
       
if (!empty($row['onlineColor']))
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
       else
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

       
// Bold any buddies.
       
if (!empty($user_info['buddies']) && in_array($row['ID_MEMBER'], $user_info['buddies']))
       {
           
$link = '<b>' . $link . '</b>';
       }

       
$data = @unserialize($row['url']);
       if(
$data['action']==$action)
           
$users[$total_count] = $link;
   }
   
mysql_free_result($result);
   
   foreach(
$users as $pos => $user)
       echo
$user, ($total_count==$pos) ? '' : ', ';
?>
Title: Re: Site Integration Mod
Post by: dwd2000 on September 26, 2008, 02:20:10 AM
Quote from: LHVWB on September 26, 2008, 12:56:19 AM
@dwd2000,
As nneonneo said that is related to this mod, you will have to add some code to the included 'chat/shoutbox' file. The topic below discusses doing something similar:
http://www.simplemachines.org/community/index.php?topic=256079.msg1688278#msg1688278 (http://www.simplemachines.org/community/index.php?topic=256079.msg1688278#msg1688278)

Although for your needs the code below should work, just remember to replace 'test' with the correct action that you need to view the list for. ;)
<?php
   
global $scripturl, $db_prefix, $user_info;

   
$action = 'test';
   
   
// Load the users online right now.
   
$result = db_query("
       SELECT
           lo.ID_MEMBER, lo.url, mem.realName, mg.onlineColor
       FROM
{$db_prefix}log_online AS lo
           LEFT JOIN
{$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
           LEFT JOIN
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
       WHERE mem.showOnline != 0
           AND mem.realName != ''"
, __FILE__, __LINE__);

   
$total_count = 0;
   
$users = array();
   
   
//    Go through each user
   
while ($row = mysql_fetch_assoc($result))
   {
       
$total_count++;
       
// Some basic color coding...
       
if (!empty($row['onlineColor']))
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
       else
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

       
// Bold any buddies.
       
if (!empty($user_info['buddies']) && in_array($row['ID_MEMBER'], $user_info['buddies']))
       {
           
$link = '<b>' . $link . '</b>';
       }

       
$data = @unserialize($row['url']);
       if(
$data['action']==$action)
           
$users[$total_count] = $link;
   }
   
mysql_free_result($result);
   
   foreach(
$users as $pos => $user)
       echo
$user, ($total_count==$pos) ? '' : ', ';
?>


Okay. Now I'm just a little confused, instead of totally confused.

When you said,  "included 'chat/shoutbox' file" I'm thinking of the file that Site Integration points to, to call the action.

This is all that's in that file:

<?php
shoutbox
();
?>


If I understand correctly, this file should now look like this:
(test changed to shoutbox and "shoutbox();" on the last line before ?>)

<?php
   
global $scripturl, $db_prefix, $user_info;

   
$action = 'shoutbox';
   
   
// Load the users online right now.
   
$result = db_query("
       SELECT
           lo.ID_MEMBER, lo.url, mem.realName, mg.onlineColor
       FROM
{$db_prefix}log_online AS lo
           LEFT JOIN
{$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
           LEFT JOIN
{$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
       WHERE mem.showOnline != 0
           AND mem.realName != ''"
, __FILE__, __LINE__);

   
$total_count = 0;
   
$users = array();
   
   
//    Go through each user
   
while ($row = mysql_fetch_assoc($result))
   {
       
$total_count++;
       
// Some basic color coding...
       
if (!empty($row['onlineColor']))
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
       else
           
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

       
// Bold any buddies.
       
if (!empty($user_info['buddies']) && in_array($row['ID_MEMBER'], $user_info['buddies']))
       {
           
$link = '<b>' . $link . '</b>';
       }

       
$data = @unserialize($row['url']);
       if(
$data['action']==$action)
           
$users[$total_count] = $link;
   }
   
mysql_free_result($result);
   
   foreach(
$users as $pos => $user)
       echo
$user, ($total_count==$pos) ? '' : ', ';
shoutbox();
?>


I did it that way.

I show up on my screen, my son shows up on his screen, but both don't show up on either, even after refreshing.

I then moved shoutbox(); to the top, just under the globals. Same thing, but now shows on the bottom.

I'm assuming it's not live, meaning it won't show someone entering or leaving until the page is refreshed. I can probably live with that, if we can get the original idea to work properly.

It's a lot closer now than before.
Title: Re: Site Integration Mod
Post by: Nathaniel on September 26, 2008, 03:07:02 AM
Thats odd, I don't seem to be having any issues with viewing other people looking at the same page. That code uses the SMF user logging table, so you have to remember that its not up-to-date and it actually doesn't get refreshed that often, so you may have to wait for the cache to be cleared before it will show new users added in the list.

For what you want, its probably better to have a list that interacts with the actual chat/shoutbox so that it will give you a current list that updates along with the shoutbox itself. I am sure that I have seen these around on SMF websites, although I can't remember exactly which mod was being used, it probably wasn't nneonneo's shoutbox...
Title: Re: Site Integration Mod
Post by: dpwren on October 03, 2008, 12:55:47 PM
The mod sounds like a great thing if I can get it working   ::). I have a few question about the mod.     Mod Name     Version     
1.    SMF 1.0.14 / 1.1.6 Update    1.0

After running the install I have an error in the test on the index.php file. Should I go ahead complte the install or try to see what the hangup is in the code first on the index.php file and run the test again?


Title: Re: Site Integration Mod
Post by: Nathaniel on October 03, 2008, 09:20:14 PM
It depends on the error, which edit isn't working?

You should be able to install it anyway and then manually perform the edit that didn't work, I can help you with that if you post that file as an attachment and tell me the error. ;)
Title: Re: Site Integration Mod
Post by: draggy on October 06, 2008, 11:35:15 AM
Thanks for this great mod LHVWB, it was just what I was looking for.

I've read through a lot of this thread and found some great fixes, but I am wondering if you know of a way to fix this problem:

I am running SMF 1.1.6 I have the site integration mod installed and working. I have a forum button setup at the top. And when I click on it, the action changes to forum and the forum tab is highlighted, etc.

But when I go into a board or a topic, the address changes to ?board=3.0 or ?topic=5.0, etc. and the forum tab at the top is no longer highlighted because forum is no longer the action, but it highlights the home button instead. Do you know of a way to make it so the forum tab stays highlighted through the rest of the forum areas?

I noticed that this is the same behavior on your demo forums, so it must be something that's just not fixed yet. If you posted the solution somewhere, I apologize, but I did not see it, and would be grateful if you could share. Thanks.
Title: Re: Site Integration Mod
Post by: jeddi on October 06, 2008, 05:21:11 PM
This looks good but I havnt got a clue how to use it. I have read your instructions and I cant find a way to use this mod.
Could you give me an example how to use it?
I want to integrate my website, so I have installed this mod, so what do I do now.
Do I create a folder/
What do I put in it
Please explain the steps I should take.
Say my website is "mywebsite.com" it has an index.php but what exactly do I do?
Title: Re: Site Integration Mod
Post by: dwd2000 on October 06, 2008, 05:25:42 PM

Quote from: draggy on October 06, 2008, 11:35:15 AM
Thanks for this great mod LHVWB, it was just what I was looking for.

I've read through a lot of this thread and found some great fixes, but I am wondering if you know of a way to fix this problem:

I am running SMF 1.1.6 I have the site integration mod installed and working. I have a forum button setup at the top. And when I click on it, the action changes to forum and the forum tab is highlighted, etc.

But when I go into a board or a topic, the address changes to ?board=3.0 or ?topic=5.0, etc. and the forum tab at the top is no longer highlighted because forum is no longer the action, but it highlights the home button instead. Do you know of a way to make it so the forum tab stays highlighted through the rest of the forum areas?

I noticed that this is the same behavior on your demo forums, so it must be something that's just not fixed yet. If you posted the solution somewhere, I apologize, but I did not see it, and would be grateful if you could share. Thanks.

Go to your index.template.php.

Find lines that look like this:

if ($context['current_action'] == 'shop')
      $current_action = 'shop';


Add another that says what you need.
(Change shop to what you need.)
Title: Re: Site Integration Mod
Post by: draggy on October 06, 2008, 05:40:25 PM
Thanks for the reply dwd2000

I assumed I needed to change something in there, but topic and board are not actions.

What variable do I need to check to see if the address string is index.php?board=x.x or ndex.php?topic=x.x?
Title: Re: Site Integration Mod
Post by: dwd2000 on October 06, 2008, 05:53:48 PM
Quote from: draggy on October 06, 2008, 05:40:25 PM
Thanks for the reply dwd2000

I assumed I needed to change something in there, but topic and board are not actions.

What variable do I need to check to see if the address string is index.php?board=x.x or ndex.php?topic=x.x?

I'm not sure about that one.


Make sure this line is in your index.template:

if (isset($_GET['board']) || isset($_GET['topic']))
$current_action = 'forum';


Title: Re: Site Integration Mod
Post by: draggy on October 06, 2008, 07:55:53 PM
Quote from: dwd2000 on October 06, 2008, 05:53:48 PM
Make sure this line is in your index.template:

if (isset($_GET['board']) || isset($_GET['topic']))
$current_action = 'forum';

Thanks, that did the trick nicely :)
Title: Re: Site Integration Mod
Post by: dpwren on October 08, 2008, 07:21:05 PM
Hello
I got everything installed but I can't see where its working right. Maybe I just don't understand your directions to the fullest. For example How would I wrap something like this using your actions. http://www.empireofthesun.net/forum/index.php?action=demo. I created a basic page and placed in the file_includes but I don't see it loading in or around the forum.
Title: Re: Site Integration Mod
Post by: Nathaniel on October 09, 2008, 02:03:40 AM
@dpwren,
Have you setup the settings in the admin panel? If they are setup correctly and you have added files into one of the folders that you have listed in the 'File/Action Include Folders' setting, then there should be a list of included files/actions in the 'Manage Included Files/Actions:' list.

Also, make sure that your files are '.php' files or that you have added their type extension to the 'Extra "File/Action Include" File Extensions' setting.
Title: Re: Site Integration Mod
Post by: dpwren on October 09, 2008, 10:41:32 AM
Thanks that gives me something to go on. I will take a look at those things at see what happens.

David
Title: Re: Site Integration Mod
Post by: legend 1234 on October 13, 2008, 05:45:33 AM
heyy

well when i go to the tab i get this error

Unable to load the 'SiteIntegrationSettings' template.

wat do i do to fix it plz
Title: Re: Site Integration Mod
Post by: Nathaniel on October 15, 2008, 06:40:54 AM
@legend 1234,
That function should be located in your 'SiteIntegration.template.php' file, which is added to your forum when the mod is installed. Something must have gone wrong with the installation. Try uninstalling and then reinstalling the mod.
Title: Re: Site Integration Mod
Post by: Nathaniel on October 20, 2008, 04:44:47 AM
For jkrlvgn:

I have split your support request into another topic and moved it to the 'SMF 1.x Support' board. The topic is located below:
http://www.simplemachines.org/community/index.php?topic=269255
Title: Re: Site Integration Mod
Post by: mikeb206 on November 01, 2008, 09:13:22 AM
Hi, I have been using your mod successfully for several months. I have just added a new include folder and for some reason can not set the permissions on some of the files in this folder, although I can on others. The Admin permission is set, and I can access all the files through SMF. Any ideas?

Thanks
Title: Re: Site Integration Mod
Post by: Nathaniel on November 01, 2008, 05:13:37 PM
What did you call that folder? If you called it something like 'test folder' then it should be named 'test_folder'. ;)
Title: Re: Site Integration Mod
Post by: mikeb206 on November 02, 2008, 01:21:00 AM
Quote from: LHVWB on November 01, 2008, 05:13:37 PM
What did you call that folder? If you called it something like 'test folder' then it should be named 'test_folder'. ;)

It was originally a sub directory of my includes folder (the one that has been working fine). It was called 'mgnt'. I have now moved it to the forum root, with the same results. And I am now getting the following error on some files only:

Duplicate entry '2-SiteIntegration:retal_auto_fai' for key 1
File: /home/kic49718/public_html/XR5/forum/Sources/ManagePermissions.php
Line: 1633

That line points to this code:

VALUES " . substr($insertRows, 2), __FILE__, __LINE__);

in this block

// Save the permissions of a form containing inline permissions.
function save_inline_permissions($permissions)
{
global $context, $db_prefix;

// No permissions? Not a great deal to do here.
if (!allowedTo('manage_permissions'))
return;

// Check they can't do certain things.
loadIllegalPermissions();

$insertRows = '';
foreach ($permissions as $permission)
{
if (!isset($_POST[$permission]))
continue;

foreach ($_POST[$permission] as $ID_GROUP => $value)
{
if (in_array($value, array('on', 'deny')) && (empty($context['illegal_permissions']) || !in_array($permission, $context['illegal_permissions'])))
$insertRows .= ', (' . (int) $ID_GROUP . ", '$permission', " . ($value == 'on' ? '1' : '0') . ')';
}
}

// Remove the old permissions...
db_query("
DELETE FROM {$db_prefix}permissions
WHERE permission IN ('" . implode("', '", $permissions) . "')" . (empty($context['illegal_permissions']) ? '' : "
AND permission NOT IN ('" . implode("', '", $context['illegal_permissions']) . "')"), __FILE__, __LINE__);

// ...and replace them with new ones.
if ($insertRows != '')
db_query("
INSERT INTO {$db_prefix}permissions
(ID_GROUP, permission, addDeny)
VALUES " . substr($insertRows, 2), __FILE__, __LINE__);
}
Title: Re: Site Integration Mod
Post by: B u m u™ on November 02, 2008, 03:28:43 AM
Thank you very muc  :D
Title: Re: Site Integration Mod
Post by: payme on November 27, 2008, 09:19:54 AM
Howdy,

I'm not sure about how to disable the home site the mod adds to the forum. I want to add just additional pages because I'm using PortaMX for the home page (I don't want to overide that index page). Is there a poss to tell me which code to exclude to just show these new tabs without the "new index page"?
Title: Re: Site Integration Mod
Post by: Dret on November 30, 2008, 07:42:06 AM
Quote
It was originally a sub directory of my includes folder (the one that has been working fine). It was called 'mgnt'. I have now moved it to the forum root, with the same results. And I am now getting the following error on some files only:

Duplicate entry '2-SiteIntegration:retal_auto_fai' for key 1
File: /home/kic49718/public_html/XR5/forum/Sources/ManagePermissions.php
Line: 1633

That line points to this code:


I have the same problem...

I use this Mod for many times without problem but recently i creted a new folder for some new pages to be "integrated" by this Mod. So now I have "extra" and "tourney" folders under Site Integration.
All seems works fine but I'm not able to set permission for the new files in the new folder ("tourney").
The operation seems to be refused and if I try to set this permissions again... this error appear:

Duplicate entry '-1-SiteIntegration:interfaccia_vi' for key 1
File: /membri/wif/Sources/ManagePermissions.php
Riga: 1618


There's also a Note that suggest me to Upgrade the DB from 1.1.6 to 1.1.7 (because seems to be old). But I have already do it, my forum is in 1.1.7 version!

Can you help me, please?

Thanks!
Bye!


Title: Re: Site Integration Mod
Post by: Afro on December 01, 2008, 12:11:55 PM
Nice one...

my question..

I have two smf forums...

http://afrowall.com/index.php
http://afrowall.com/bestofjokes.

Both on the same domain and host.

I want to integrate them in a way that one registration from the first forum will be sued to login in both of them...

Is that possible with this mod and what should i do?

Title: Re: Site Integration Mod
Post by: Burke ♞ Knight on December 01, 2008, 12:31:03 PM
This mod is to integrate site pages into your SMF forum.

In order to do as you want, I'd recommend asking in the support board for the version of SMF you are running.
Title: Re: Site Integration Mod
Post by: Afro on December 01, 2008, 01:05:26 PM
yea, i have posted a related question on the support section..
Title: Re: Site Integration Mod
Post by: djhowarth on December 04, 2008, 08:15:10 PM
Hi Im Using The MOD In The Title, I Made A Folder Called main_site and i put my index.php in their and it dint work so i renamed it to home.php and it worked but it was calling my other files e.g config.php and mysql.php so i put all them in the main_site folder and i installed that properly but when i go to the link to index.php?action=home it loads up page saying  DB Connection But When I Go The The Site Directly It Works!

In The Integration MOD All The Files and folders are their, so as anyone got any ideas and also i think the home.php needs 2 be index.php is their away around that ???
Title: Re: Site Integration Mod
Post by: djhowarth on December 04, 2008, 08:21:06 PM
Adding On From Above

The Error Is DATABASE: mysql_connect:

The File I Think Causing The Problem Is The One Below!


<?php

error_reporting
(E_ALL ^ E_NOTICE);
// register_globals on *fix*
if (!ini_get("register_globals")) {
   
import_request_variables('GPC');
}

//If running on a windows server you "may" have to use absolute paths here

require_once("mysql.php");  //Get Site Settings and Vars ($site_config)
require_once("config.php"); //Get MYSQL Connection Info
require("tzs.php"); // Get Timezones

function dbconn($autoclean = false) {
global $mysql_host, $mysql_user, $mysql_pass, $mysql_db, $THEME, $LANGUAGE, $site_config;

if (extension_loaded('zlib') && !ini_get('zlib.output_compression'))
ob_start('ob_gzhandler');
else
ob_start();

header("Content-Type: text/html;charset=$site_config[CHARSET]");

if (!function_exists("mysql_connect"))
die("MySQL support not available.");

   if (!@
mysql_connect($mysql_host, $mysql_user, $mysql_pass))
   {
     die(
'DATABASE: mysql_connect: ' . mysql_error());
   }
   
mysql_select_db($mysql_db)
       or die(
'DATABASE: mysql_select_db: ' . mysql_error());

unset($mysql_pass); //security

   
userlogin(); //Get user info

//Get language and theme
$CURUSER = $GLOBALS["CURUSER"];
if ($CURUSER)  {
$ss_a = @mysql_fetch_array(@mysql_query("SELECT uri FROM stylesheets WHERE id=$CURUSER[stylesheet]"));
       if (
$ss_a)
           
$THEME = $ss_a["uri"];
       else {
           
$ss_a = @mysql_fetch_array(@mysql_query("select uri from stylesheets where id=$site_config[default_theme]"));
           
$THEME = $ss_a['uri'];
       }
       
$lng_a = @mysql_fetch_array(@mysql_query("select uri from languages where id=$CURUSER[language]"));
       if (
$lng_a)
           
$LANGUAGE = $lng_a["uri"];
       else {
           
$lng_a = @mysql_fetch_array(@mysql_query("select uri from languages where id=$site_config[default_language]"));
           
$LANGUAGE = $lng_a['uri'];
       }
}else{//not logged in so get default theme/language
$ss_a = mysql_fetch_array(mysql_query("select uri from stylesheets where id='" . $site_config['default_theme'] . "'")) or die(mysql_error());
if ($ss_a)
$THEME = $ss_a["uri"];
$lng_a = mysql_fetch_array(mysql_query("select uri from languages where id='" . $site_config['default_language'] . "'")) or die(mysql_error());
if ($lng_a)
$LANGUAGE = $lng_a["uri"];
}
require_once("languages/$LANGUAGE");



if ($autoclean)
autoclean();
}

// Main Cleanup
function autoclean() {
global $site_config;
   require_once(
"cleanup.php");

   
$now = gmtime();

   
$res = mysql_query("SELECT last_time FROM tasks WHERE task='cleanup'");
   
$row = mysql_fetch_array($res);
   if (!
$row) {
       
mysql_query("INSERT INTO tasks (task, last_time) VALUES ('cleanup',$now)");
       return;
   }
   
$ts = $row[0];
   if (
$ts + $site_config["autoclean_interval"] > $now)
       return;
   
mysql_query("UPDATE tasks SET last_time=$now WHERE task='cleanup' AND last_time = $ts");
   if (!
mysql_affected_rows())
       return;

   
do_cleanup();
}

// IP Validation
function validip($ip)
{
if (!empty($ip) && $ip == long2ip(ip2long($ip)))
{
$reserved_ips = array (
array('0.0.0.0','2.255.255.255'),
array('10.0.0.0','10.255.255.255'),
array('127.0.0.0','127.255.255.255'),
array('169.254.0.0','169.254.255.255'),
array('172.16.0.0','172.31.255.255'),
array('192.0.2.0','192.0.2.255'),
array('192.168.0.0','192.168.255.255'),
array('255.255.255.0','255.255.255.255')
);

foreach ($reserved_ips as $r)
{
$min = ip2long($r[0]);
$max = ip2long($r[1]);
if ((ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false;
}
return true;
}
else return false;
}

function
getip() {
  if (isset(
$_SERVER)) {
    if (isset(
$_SERVER['HTTP_X_FORWARDED_FOR']) && validip($_SERVER['HTTP_X_FORWARDED_FOR'])) {
     
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } elseif (isset(
$_SERVER['HTTP_CLIENT_IP']) && validip($_SERVER['HTTP_CLIENT_IP'])) {
     
$ip = $_SERVER['HTTP_CLIENT_IP'];
    } else {
     
$ip = $_SERVER['REMOTE_ADDR'];
    }
  } else {
    if (
getenv('HTTP_X_FORWARDED_FOR') && validip(getenv('HTTP_X_FORWARDED_FOR'))) {
     
$ip = getenv('HTTP_X_FORWARDED_FOR');
    } elseif (
getenv('HTTP_CLIENT_IP') && validip(getenv('HTTP_CLIENT_IP'))) {
     
$ip = getenv('HTTP_CLIENT_IP');
    } else {
     
$ip = getenv('REMOTE_ADDR');
    }
  }
  return
$ip;
}

function
userlogin() {
   global
$CURUSER;
   unset(
$GLOBALS["CURUSER"]);

$ip = getip(); //GET USERS IP

//Check IP bans    
/* $nip = ip2long($ip);
   $res = mysql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last")  or die(mysql_error());
   if (mysql_num_rows($res) > 0)
   {
     $row = mysql_fetch_array($res);
     header("HTTP/1.0 403 Forbidden");
     print("<html><head><title>Forbidden</title></head><body><h1>Forbidden</h1>Unauthorized IP address.<br />Reason for banning: " . $row["comment"] . "</body></html>\n");
     die;
   }*/


//Check The Cookie and get CURUSER details
if (empty($_COOKIE["uid"]) || empty($_COOKIE["pass"]))
       return;

   
$id = 0 + $_COOKIE["uid"]; //Get User ID from cookie
   
if (!$id)
return;

//Get User Details And Permissions
   
$res = mysql_query("SELECT * FROM users INNER JOIN groups ON users.class=groups.group_id WHERE users.id = $id AND users.enabled='yes' AND users.status = 'confirmed'") or die(mysql_error());
   
$row = mysql_fetch_array($res);

if (!$row)
       return;

//Check PW in cookie matches DB (after adding secret to the hash)
$sec = hash_pad($row["secret"]);
   if (
$_COOKIE["pass"] != md5($sec . $row["password"] . $sec))
       return;

   
mysql_query("UPDATE users SET last_access='" . get_date_time() . "', ip=".sqlesc($ip)." WHERE id=" . $row["id"]) or die(mysql_error());

   
$GLOBALS["CURUSER"] = $row;
unset($row);
}

function
logincookie($id, $password, $secret, $updatedb = 1, $expires = 0x7fffffff) {
   
$md5 = md5($secret . $password . $secret);
   
setcookie("uid", $id, $expires, "/");
   
setcookie("pass", $md5, $expires, "/");

   if (
$updatedb)
       
mysql_query("UPDATE users SET last_login = '".get_date_time()."' WHERE id = $id");
}

function
logoutcookie() {
setcookie("uid", "null", time(), "/");
setcookie("pass", "null", time(), "/");
}

function
stdhead($title = "") {
global $site_config, $CURUSER, $THEME, $LANGUAGE;  //Define globals

//require_once("cleanup.php");  //temp cleanup linkage :D
//docleanup();//TEMP CLEANUP CALL

//site online check
if (!$site_config["SITE_ONLINE"]){
if ($CURUSER["level"]!=="Administrator") {
echo '<BR><BR><BR><CENTER>'. stripslashes($site_config["OFFLINEMSG"]) .'</CENTER><BR><BR>';
die;
}else{
echo '<BR><BR><BR><CENTER><B><FONT COLOR=RED>SITE OFFLINE, ADMIN ONLY VIEWING! DO NOT LOGOUT</FONT></B><BR>If you logout please edit backend/config.php and set SITE_ONLINE to true </CENTER><BR><BR>';
}
}
//end check

   
if (!$CURUSER)
guestadd();

   if (
$title == "")
       
$title = $site_config['SITENAME'];
   else
       
$title = $site_config['SITENAME']. " : ". htmlspecialchars($title);

require_once("themes/" . $THEME . "/block.php");
require_once("themes/" . $THEME . "/header.php");
}

function
stdfoot() {
global $site_config, $CURUSER, $THEME, $LANGUAGE;
require_once("themes/" . $THEME . "/footer.php");
mysql_close();
}

function
leftblocks() {
global $site_config, $CURUSER, $THEME, $LANGUAGE;  //Define globals
$res=mysql_query("SELECT * FROM blocks WHERE position='left' AND enabled=1 ORDER BY sort");
$i=0;
$blocks=array();
while($result=mysql_fetch_array($res)){
if($result["position"]) {
$block=$result["name"];
$blocks[$i++]=$block;
}
}

foreach ($blocks as $blockfilename){
include("blocks/".$blockfilename."_block.php");
}
}

function
rightblocks() {
global $site_config, $CURUSER, $THEME, $LANGUAGE;  //Define globals
$res=mysql_query("SELECT * FROM blocks WHERE position='right' AND enabled=1 ORDER BY sort");
$i=0;
$blocks=array();
while($result=mysql_fetch_array($res)){
if($result["position"]) {
$block=$result["name"];
$blocks[$i++]=$block;
}
}

foreach ($blocks as $blockfilename){
include("blocks/".$blockfilename."_block.php");
}
}

function
middleblocks() {
global $site_config, $CURUSER, $THEME, $LANGUAGE;  //Define globals
$res=mysql_query("SELECT * FROM blocks WHERE position='middle' AND enabled=1 ORDER BY sort");
$i=0;
$blocks=array();
while($result=mysql_fetch_array($res)){
if($result["position"]) {
$block=$result["name"];
$blocks[$i++]=$block;
}
}

foreach ($blocks as $blockfilename){
include("blocks/".$blockfilename."_block.php");
}
}

function
show_error_msg($title, $message, $wrapper = "1") {
   if (
$wrapper=="1") {
stdhead($title);
//echo "<b>DEBUG: stdhead Wrapper ON/Kill php gen further</b>";//remove later
}
begin_frame("<font color=red>". htmlspecialchars($title) ."</font>");
print("<p><CENTER><B>" . stripslashes(sqlesc($message)) . "</B></CENTER></p>\n");
end_frame();

   if (
$wrapper=="1"){
stdfoot();
die();
}
}

//calculate health
/* ********* OLD ********
function health($leechers, $seeders) {
if ($leechers == 0){
if ($seeders == 0)
return 1;
else return 10;
}else{
$ratio = round(10 / ($seeders + $leechers) * $seeders);
if ($ratio < 1 )
$ratio = 1;
if ($ratio > 10 )
$ratio = 10;
return $ratio;
}
}
******************** */

// New (TorrentialStorm 19/Feb/2008 @ 13:15)
function health($leechers, $seeders) {
if (($leechers == 0 && $seeders == 0) || ($leechers > 0 && $seeders == 0))
return 0;
elseif ($seeders > $leechers)
return 10;

$ratio = $seeders / $leechers * 100;
if ($ratio > 0 && $ratio < 15)
return 1;
elseif ($ratio >= 15 && $ratio < 25)
return 2;
elseif ($ratio >= 25 && $ratio < 35)
return 3;
elseif ($ratio >= 35 && $ratio < 45)
return 4;
elseif ($ratio >= 45 && $ratio < 55)
return 5;
elseif ($ratio >= 55 && $ratio < 65)
return 6;
elseif ($ratio >= 65 && $ratio < 75)
return 7;
elseif ($ratio >= 75 && $ratio < 85)
return 8;
elseif ($ratio >= 85 && $ratio < 95)
return 9;
else
return 10;
}


//secure vars
function sqlesc($x) {
  if (
get_magic_quotes_gpc()) {
     
$x = stripslashes($x);
  }
  if (!
is_numeric($x)) {
     
$x = "'".mysql_real_escape_string($x)."'";
  }
  return
$x;
}


function
unesc($x) {
   return
$x;
}

function
mkglobal($vars) {
   if (!
is_array($vars))
       
$vars = explode(":", $vars);
   foreach (
$vars as $v) {
       if (isset(
$_GET[$v]))
           
$GLOBALS[$v] = stripslashes($_GET[$v]);
       elseif (isset(
$_POST[$v]))
           
$GLOBALS[$v] = stripslashes($_POST[$v]);
       else
           return
0;
   }
   return
1;
}

function
hash_pad($hash) {
   return
str_pad($hash, 20);
}

function
hash_where($name, $hash) {
   
$shhash = preg_replace('/ *$/s', "", $hash);
   return
"($name = " . sqlesc($hash) . " OR $name = " . sqlesc($shhash) . ")";
}

function
file_ungzip($fromFile){
$zp = @gzopen($fromFile, "r");
while(!@gzeof($zp)) { $string .= @gzread($zp, 4096); }
@gzclose($zp);
return $string;
}

function
mksize($bytes) {
if ($bytes < 1000 * 1024)
return number_format($bytes / 1024, 2) . " KB";
if ($bytes < 1000 * 1048576)
return number_format($bytes / 1048576, 2) . " MB";
if ($bytes < 1000 * 1073741824)
return number_format($bytes / 1073741824, 2) . " GB";
return number_format($bytes / 1099511627776, 2) . " TB";
}

function
escape_url($url) {
$ret = '';
for($i = 0; $i < strlen($url); $i+=2)
$ret .= '%'.$url[$i].$url[$i + 1];
return $ret;
}

function
torrent_scrape_url($scrape, $hash) {
ini_set('default_socket_timeout',10);
@$fp = file_get_contents($scrape.'?info_hash='.escape_url($hash));
$ret = array();
if(!$fp) {
$ret['seeds'] = -1;
$ret['peers'] = -1;
}else{
$stats = BDecode($fp);
$binhash = addslashes(pack("H*", $hash));
$seeds = $stats['files'][$binhash]['complete'];
$peers = $stats['files'][$binhash]['incomplete'];
$downloaded = $stats['files'][$binhash]['downloaded'];
$ret['seeds'] = $seeds;
$ret['peers'] = $peers;
$ret['downloaded'] = $downloaded;
}
return $ret;
}

function
mkprettytime($s) {
   if (
$s < 0)
       
$s = 0;
   
$t = array();
   foreach (array(
"60:sec","60:min","24:hour","0:day") as $x) {
       
$y = explode(":", $x);
       if (
$y[0] > 1) {
           
$v = $s % $y[0];
           
$s = floor($s / $y[0]);
       }
       else
           
$v = $s;
       
$t[$y[1]] = $v;
   }

   if (
$t["day"])
       return
$t["day"] . "d " . sprintf("%02d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]);
   if (
$t["hour"])
       return
sprintf("%d:%02d:%02d", $t["hour"], $t["min"], $t["sec"]);
       return
sprintf("%d:%02d", $t["min"], $t["sec"]);
}

function
gmtime() {
   return
strtotime(get_date_time());
}

function
loggedinonly() {
global $CURUSER;
if (!$CURUSER) {
header("Refresh: 0; url=account-login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]));
exit();
}
$wherethisuser = where ($_SERVER["SCRIPT_FILENAME"],$CURUSER["id"]);
}

function
validfilename($name) {
   return
preg_match('/^[^\0-\x1f:\\\\\/?*\xff#<>|]+$/si', $name);
}

function
validemail($email) {
//    return preg_match('/^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/is', $email);
   
return preg_match('/^([a-z0-9._-](\+[a-z0-9])*)+@[a-z0-9.-]+\.[a-z]{2,6}$/i', $email);
}

function
urlparse($m) {
   
$t = $m[0];
   if (
preg_match(',^\w+://,', $t))
       return
"<a href=\"$t\">$t</a>";
   return
"<a href=\"http://$t\">$t</a>";
}

function
parsedescr($d, $html) {
   if (!
$html)
   {
     
$d = htmlspecialchars($d);
     
$d = str_replace("\n", "\n<br />", $d);
   }
   return
$d;
}

function
mksecret($len = 20) {
   
$ret = "";
   for (
$i = 0; $i < $len; $i++)
       
$ret .= chr(mt_rand(0, 255));
   return
$ret;
}

function
deletetorrent($id) {
global $site_config;

$row = @mysql_fetch_array(@mysql_query("SELECT image1,image2 FROM torrents WHERE id=$id"));

foreach(explode(".","peers.comments.ratings") as $x)
mysql_query("DELETE FROM $x WHERE torrent = $id");

if (file_exists("".$site_config["torrent_dir"]."/$id.torrent"))
unlink("".$site_config["torrent_dir"]."/$id.torrent");

if ($row["image1"]) {
$img1 = "".$site_config["torrent_dir"]."/images/".$row["image1"]."";
$del = unlink($img1);
}

if ($row["image2"]) {
$img2 = "".$site_config["torrent_dir"]."/images/".$row["image2"]."";
$del = unlink($img2);
}

mysql_query("DELETE FROM torrents WHERE id = $id");
}

function
deleteaccount($userid) {
mysql_query("DELETE FROM users WHERE id = $userid");
mysql_query("DELETE FROM warnings WHERE userid = $userid");
mysql_query("DELETE FROM ratings WHERE user = $userid");
}

function
genrelist() {
   
$ret = array();
   
$res = mysql_query("SELECT id, name, parent_cat FROM categories ORDER BY parent_cat ASC, sort_index ASC");
   while (
$row = mysql_fetch_array($res))
       
$ret[] = $row;
   return
$ret;
}

function
langlist() {
   
$ret = array();
   
$res = mysql_query("SELECT id, name, image FROM torrentlang ORDER BY sort_index, id");
   while (
$row = mysql_fetch_array($res))
       
$ret[] = $row;
   return
$ret;
}

function
is_valid_id($id){
return is_numeric($id) && ($id > 0) && (floor($id) == $id);
}

function
sql_timestamp_to_unix_timestamp($s){
return mktime(substr($s, 11, 2), substr($s, 14, 2), substr($s, 17, 2), substr($s, 5, 2), substr($s, 8, 2), substr($s, 0, 4));
}

function
write_log($text){
$text = sqlesc($text);
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO log (added, txt) VALUES($added, $text)") or sqlerr();
}

function
get_elapsed_time($ts){
 
$mins = floor((gmtime() - $ts) / 60);
 
$hours = floor($mins / 60);
 
$mins -= $hours * 60;
 
$days = floor($hours / 24);
 
$hours -= $days * 24;
 
$weeks = floor($days / 7);
 
$days -= $weeks * 7;
 
$t = "";
 if (
$weeks > 0)
   return
"$weeks wk" . ($weeks > 1 ? "s" : "");
 if (
$days > 0)
   return
"$days day" . ($days > 1 ? "s" : "");
 if (
$hours > 0)
   return
"$hours hr" . ($hours > 1 ? "s" : "");
 if (
$mins > 0)
   return
"$mins min" . ($mins > 1 ? "s" : "");
 return
"< 1 min";
}

function
hex2bin($hexdata) {
$bindata = "";
for ($i=0;$i<strlen($hexdata);$i+=2) {
$bindata.=chr(hexdec(substr($hexdata,$i,2)));
}
return $bindata;
}

function
guestadd() {
   
$ip = $_SERVER["REMOTE_ADDR"];
$sql = mysql_query("SELECT time FROM guests WHERE ip='$ip'");
   
$ctime = gmtime();
   if (
mysql_fetch_row($sql))
{
@mysql_query("UPDATE guests SET ip='$ip', time='$ctime' WHERE ip='$ip'");
   } else {
@mysql_query("INSERT INTO guests (ip, time) VALUES ('$ip', '$ctime')");
   }
}

function
getguests() {
   
$ip = $_SERVER["REMOTE_ADDR"];
   
$past = gmtime()-2400;
@mysql_query("DELETE FROM guests WHERE time < $past");
$guests = number_format(get_row_count("guests"));
return $guests;
}

function
time_ago($addtime) {
 
$addtime = get_elapsed_time(sql_timestamp_to_unix_timestamp($addtime));
  return
$addtime;
}

function
CutName ($vTxt, $Car) {
while(strlen($vTxt) > $Car) {
return substr($vTxt, 0, $Car) . "...";
} return $vTxt;
}

function
searchfield($s) {
   return
preg_replace(array('/[^a-z0-9]/si', '/^\s*/s', '/\s*$/s', '/\s+/s'), array(" ", "", "", " "), $s);
}

function
get_row_count($table, $suffix = "") {
 if (
$suffix)
   
$suffix = " $suffix";
 (
$r = mysql_query("SELECT COUNT(*) FROM $table$suffix")) or die(mysql_error());
 (
$a = mysql_fetch_row($r)) or die(mysql_error());
 return
$a[0];
}

function
sqlerr($query = "") {
stdhead();
begin_frame("MYSQL Error");
print("<BR><b>MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
end_frame();
stdfoot();
die;
}

function
get_dt_num(){
return gmdate("YmdHis");
}


function
get_date_time($timestamp = 0){
if ($timestamp)
return date("Y-m-d H:i:s", $timestamp);
else
 return gmdate("Y-m-d H:i:s");
}

// Convert UTC to user's timezone
function utc_to_tz ($timestamp=0) {
GLOBAL $CURUSER;
if (!is_numeric($timestamp))
$timestamp = sql_timestamp_to_unix_timestamp($timestamp);
if ($timestamp == 0)
$timestamp = gmtime();

$timestamp = $timestamp + ($CURUSER['tzoffset']*60);
return date("Y-m-d H:i:s", $timestamp);
}

function
utc_to_tz_time ($timestamp=0) {
GLOBAL $CURUSER;

if (!is_numeric($timestamp))
$timestamp = sql_timestamp_to_unix_timestamp($timestamp);
if ($timestamp == 0)
$timestamp = gmtime();

$timestamp = $timestamp + ($CURUSER['tzoffset']*60);
return $timestamp;
}

function
encodehtml($s, $linebreaks = true) {
 $s = str_replace("<", "&lt;", str_replace("&", "&amp;", $s));
 if ($linebreaks)
$s = nl2br($s);
 return $s;
}


function
format_urls($s){
return preg_replace(
   
"/(\A|[^=\]'\"a-zA-Z0-9])((http|ftp|https|ftps|irc):\/\/[^<>\s]+)/i",
   
"\\1<a href=http://anonym.to/?\\2 target=_blank>\\2</a>", $s);
}

function
format_comment($text)
{
global $site_config, $smilies;

$s = $text;

$s = htmlspecialchars($s);
$s = stripslashes($s);
$s = format_urls($s);

// [*]
$s = preg_replace("/\[\*\]/", "<li>", $s);

// [b]Bold[/b]
$s = preg_replace("/\[b\]((\s|.)+?)\[\/b\]/", "<b>\\1</b>", $s);

// [i]Italic[/i]
$s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "<i>\\1</i>", $s);

// [u]Underline[/u]
$s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/", "<u>\\1</u>", $s);

// [u]Underline[/u]
$s = preg_replace("/\[u\]((\s|.)+?)\[\/u\]/i", "<u>\\1</u>", $s);

// [img]http://www/image.gif[/img]
$s = preg_replace("/\[img\](http:\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg))\[\/img\]/i", "<img border=0 src=\"\\1\">", $s);

// [img=http://www/image.gif]
$s = preg_replace("/\[img=(http:\/\/[^\s'\"<>]+(\.gif|\.jpg|\.png|\.bmp|\.jpeg))\]/i", "<img border=0 src=\"\\1\">", $s);

// [color=blue]Text[/color]
$s = preg_replace(
"/\[color=([a-zA-Z]+)\]((\s|.)+?)\[\/color\]/i",
"<font color=\\1>\\2</font>", $s);

// [color=#ffcc99]Text[/color]
$s = preg_replace(
"/\[color=(#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])\]((\s|.)+?)\[\/color\]/i",
"<font color=\\1>\\2</font>", $s);

// [url=http://www.example.com]Text[/url]
$s = preg_replace(
"/\[url=((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\]((\s|.)+?)\[\/url\]/i",
"<a href=http://anonym.to/?\\1 target=_blank>\\3</a>", $s);

// [url]http://www.example.com[/url]
$s = preg_replace(
"/\[url\]((http|ftp|https|ftps|irc):\/\/[^<>\s]+?)\[\/url\]/i",
"<a href=http://anonym.to/?\\1 target=_blank>\\1</a>", $s);

// [size=4]Text[/size]
$s = preg_replace(
"/\[size=([1-7])\]((\s|.)+?)\[\/size\]/i",
"<font size=\\1>\\2</font>", $s);

// [font=Arial]Text[/font]
$s = preg_replace(
"/\[font=([a-zA-Z ,]+)\]((\s|.)+?)\[\/font\]/i",
"<font face=\"\\1\">\\2</font>", $s);

//[quote]Text[/quote]
$s = preg_replace(
"/\[quote\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
"<p class=sub><b>Quote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\1</td></tr></table><br />", $s);

//[quote=Author]Text[/quote]
$s = preg_replace(
"/\[quote=(.+?)\]\s*((\s|.)+?)\s*\[\/quote\]\s*/i",
"<p class=sub><b>\\1 wrote:</b></p><table class=main border=1 cellspacing=0 cellpadding=10><tr><td style='border: 1px black dotted'>\\2</td></tr></table><br />", $s);
               
   
//[hr]
       
$s = preg_replace("/\[hr\]/i", "<hr>", $s);

   
//[hr=#ffffff] [hr=red]
       
$s = preg_replace("/\[hr=((#[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9])|([a-zA-z]+))\]/i", "<hr color=\"\\1\"/>", $s);

       
//[swf]http://somesite.com/test.swf[/swf]
       
$s = preg_replace("/\[swf\]((www.|http:\/\/|https:\/\/)[^\s]+(\.swf))\[\/swf\]/i",
       
"<param name=movie value=\\1/><embed width=470 height=310 src=\\1></embed>", $s);

       
//[swf=http://somesite.com/test.swf]
       
$s = preg_replace("/\[swf=((www.|http:\/\/|https:\/\/)[^\s]+(\.swf))\]/i",
       
"<param name=movie value=\\1/><embed width=470 height=310 src=\\1></embed>", $s);

// Linebreaks
$s = nl2br($s);

// Maintain spacing
$s = str_replace("  ", " &nbsp;", $s);

// Smilies
require_once("smilies.php");
reset($smilies);
while (list($code, $url) = each($smilies))
$s = str_replace($code, "<img border=0 src=" . $site_config['SITEURL'] . "/images/smilies/$url>", $s);

return $s;
}



function
torrenttable($res) {
global $site_config, $CURUSER, $THEME, $LANGUAGE;  //Define globals

if ($site_config["MEMBERSONLY_WAIT"] && $site_config["MEMBERSONLY"] && in_array($CURUSER["class"], explode(",",$site_config["WAIT_CLASS"]))) {
$gigs = $CURUSER["uploaded"] / (1024*1024*1024);
$ratio = (($CURUSER["downloaded"] > 0) ? ($CURUSER["uploaded"] / $CURUSER["downloaded"]) : 0);
if ($ratio < 0 || $gigs < 0) $wait = $site_config["WAITA"];
elseif ($ratio < $site_config["RATIOA"] || $gigs < $site_config["GIGSA"]) $wait = $site_config["WAITA"];
elseif ($ratio < $site_config["RATIOB"] || $gigs < $site_config["GIGSB"]) $wait = $site_config["WAITB"];
elseif ($ratio < $site_config["RATIOC"] || $gigs < $site_config["GIGSC"]) $wait = $site_config["WAITC"];
elseif ($ratio < $site_config["RATIOD"] || $gigs < $site_config["GIGSD"]) $wait = $site_config["WAITD"];
else $wait = 0;
}

// Columns
$cols = explode(",", $site_config["torrenttable_columns"]);
$cols = array_map("strtolower", $cols);
$cols = array_map("trim", $cols);
$colspan = count($cols);
// End

// Expanding Area
$expandrows = array();
if (!empty($site_config["torrenttable_expand"])) {
$expandrows = explode(",", $site_config["torrenttable_expand"]);
$expandrows = array_map("strtolower", $expandrows);
$expandrows = array_map("trim", $expandrows);
}
// End

echo '<table align=center cellpadding="0" cellspacing="0" class="ttable_headinner" width=99%>';

foreach ($cols as $col) {
switch ($col) {
case 'category':
echo "<td class=ttable_head>".TYPE."</td>";
break;
case 'name':
echo "<td class=ttable_head>".NAME."</td>";
break;
case 'dl':
echo "<td class=ttable_head>DL</td>";
break;
case 'uploader':
echo "<td class=ttable_head>".UPLOADER."</td>";
break;
case 'comments':
echo "<td class=ttable_head>Comm</td>";
break;
case 'nfo':
echo "<td class=ttable_head>NFO</td>";
break;
case 'size':
echo "<td class=ttable_head>".SIZE."</td>";
break;
case 'complete':
echo "<td class=ttable_head>C</td>";
break;
case 'seeders':
echo "<td class=ttable_head>S</td>";
break;
case 'leechers':
echo "<td class=ttable_head>L</td>";
break;
case 'health':
echo "<td class=ttable_head>".HEALTH."</td>";
break;
case 'external':
if ($site_config["ALLOWEXTERNAL"])
echo "<td class=ttable_head>L/E</td>";
break;
case 'added':
echo "<td class=ttable_head>".DATE_ADDED."</td>";
break;
case 'speed':
echo "<td class=ttable_head>".SPEED."</td>";
break;
case 'wait':
if ($wait)
echo "<td class=ttable_head>".WAIT."</td>";
break;
case 'rating':
echo "<td class=ttable_head>".RATINGS."</td>";
break;
}
}
if ($wait && !in_array("wait", $cols))
echo "<td class=ttable_head>".WAIT."</td>";

echo "</tr>";

while ($row = mysql_fetch_assoc($res)) {
$id = $row["id"];

print("<tr>\n");

$x = 1;

foreach ($cols as $col) {
switch ($col) {
case 'category':
print("<td class=ttable_col$x align=center valign=middle>");
if (!empty($row["cat_name"])) {
print("<a href=\"torrents.php?cat=" . $row["category"] . "\">");
if (!empty($row["cat_pic"]) && $row["cat_pic"] != "")
print("<img border=\"0\"src=\"" . $site_config['SITEURL'] . "/images/categories/" . $row["cat_pic"] . "\" alt=\"" . $row["cat_name"] . "\" />");
else
print($row["cat_parent"].": ".$row["cat_name"]);
print("</a>");
} else
print("-");
print("</td>\n");
break;
case 'name':
$char1 = 35; //cut name length
$smallname = CutName(htmlspecialchars($row["name"]), $char1);
$dispname = "<b>".$smallname."</b>";

$last_access = $CURUSER["last_browse"];
$time_now = gmtime();
if ($last_access > $time_now || !is_numeric($last_access))
$last_access = $time_now;
if (sql_timestamp_to_unix_timestamp($row["added"]) >= $last_access)
$dispname .= "<b><font color=red> - ("._NEW."!)</font></b>";

if ($row["freeleech"] == 1)
$dispname .= " <img src='images/free.gif' border='0'>";
print("<td class=ttable_col$x nowrap>".(count($expandrows)?"<a href=\"javascript: klappe_torrent('t".$row['id']."')\"><img border=\"0\" src=\"".$site_config["SITEURL"]."/images/plus.gif\" id=\"pict".$row['id']."\" alt=\"Show/Hide\" class=\"showthecross\"></a>":"")."&nbsp;<a title=\"".$row["name"]."\" href=\"torrents-details.php?id=$id&amp;hit=1\">$dispname</a>");
break;
case 'dl':
print("<td class=ttable_col$x align=center><a href=\"download.php?id=$id&name=" . rawurlencode($row["filename"]) . "\"><img src=" . $site_config['SITEURL'] . "/images/icon_download.gif border=0 alt=\"Download .torrent\"></a></td>");
break;
case 'uploader':
echo "<td class=ttable_col$x align=center>";
if (($row["anon"] == "yes" || $row["privacy"] == "strong") && !($CURUSER["id"] == $row["owner"] || $CURUSER["edit_torrents"] == "yes"))
echo "Anonymous";
elseif ($row["username"])
echo "<a href='account-details.php?id=$row[owner]'>$row[username]</a>";
else
echo "Unknown";
echo "</td>";
break;
case 'comments':
print("<td class=ttable_col$x align=center><font size=1 face=Verdana><a href=comments.php?type=torrent&id=$id>" . $row["comments"] . "</a></td>\n");
break;
case 'nfo':
if ($row["nfo"] == "yes")
print("<td class=ttable_col$x align=center><a href=nfo-view.php?id=$row[id]><img  src=" . $site_config['SITEURL'] . "/images/icon_nfo.gif border=0 alt='View NFO'></a></td>");
else
print("<td class=ttable_col$x align=center>-</td>");
break;
case 'size':
print("<td class=ttable_col$x align=center>".mksize($row["size"])."</td>\n");
break;
case 'complete':
print("<td class=ttable_col$x align=center><font color=orange><B>".number_format($row["times_completed"])."</B></font></td>");
break;
case 'seeders':
print("<td class=ttable_col$x align=center><b><font color=green><B>".number_format($row["seeders"])."</b></font></td>\n");
break;
case 'leechers':
print("<td class=ttable_col$x align=center><font color=red><B>" . $row["leechers"] . "</b></font></td>\n");
break;
case 'health':
print("<td class=ttable_col$x align=center><img src=".$site_config["SITEURL"]."/images/health_".health($row["leechers"], $row["seeders"]).".gif></td>\n");
break;
case 'external':
if ($site_config["ALLOWEXTERNAL"]){
if ($row["external"]=='yes')
print("<td class=ttable_col$x align=center>E</td>\n");
else
print("<td class=ttable_col$x align=center>L</td>\n");
}
break;
case 'added':
print("<td class=ttable_col$x align=center>".date("d-m-Y<\\B\\R>H:i:s", utc_to_tz_time($row['added']))."</td>");
break;
case 'speed':
if ($row["external"] != "yes" && $row["leechers"] >= 1){
$speedQ = mysql_query("SELECT (SUM(downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(started)) AS totalspeed FROM peers WHERE seeder = 'no' AND torrent = '$id'ORDER BY started ASC") or die(mysql_error());
$a = mysql_fetch_assoc($speedQ);
$totalspeed = mksize($a["totalspeed"]) . "/s";
} else
$totalspeed = "--";
print("<td class=ttable_col$x align=center>$totalspeed</td>");
break;
case 'wait':
if ($wait){
$elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
if ($elapsed < $wait && $row["external"] != "yes") {
$color = dechex(floor(127*($wait - $elapsed)/48 + 128)*65536);
print("<td class=ttable_col$x align=center><a href=\"faq.php\"><font color=\"$color\">" . number_format($wait - $elapsed) . " h</font></a></td>\n");
} else
print("<td class=ttable_col$x align=center>--</td>\n");
}
break;
case 'rating':
if (!$row["rating"])
$rating = "--";
else
$rating = "<a title='$row[rating]/5'>".ratingpic($row["rating"])."</a>";
//$rating = ratingpic($row["rating"]);
                    //$srating .= "$rpic (" . $row["rating"] . " out of 5) " . $row["numratings"] . " users have rated this torrent";
print("<td class=ttable_col$x align=center>$rating</td>");
break;
}
if ($x == 2)
$x--;
else
$x++;
}


//Wait Time Check
if ($wait && !in_array("wait", $cols)) {
$elapsed = floor((gmtime() - strtotime($row["added"])) / 3600);
if ($elapsed < $wait && $row["external"] != "yes") {
$color = dechex(floor(127*($wait - $elapsed)/48 + 128)*65536);
print("<td class=ttable_col$x align=center><a href=\"faq.php\"><font color=\"$color\">" . number_format($wait - $elapsed) . " h</font></a></td>\n");
} else
print("<td class=ttable_col$x align=center>--</td>\n");
$colspan++;
if ($x == 2)
$x--;
else
$x++;
}

print("</tr>\n");

//Expanding area
if (count($expandrows)) {
print("<tr><td class=ttable_col$x colspan=$colspan><div id=\"kt".$row['id']."\" style=\"margin-left: 70px; display: none;\">");
print("<table width=97% border=0 cellspacing=0 cellpadding=0>");
foreach ($expandrows as $expandrow) {
switch ($expandrow) {
case 'size':
print("<tr><td><B>".SIZE."</B>: ".mksize($row['size'])."</td></tr>");
break;
case 'speed':
if ($row["external"] != "yes" && $row["leechers"] >= 1){
$speedQ = mysql_query("SELECT (SUM(downloaded)) / (UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(started)) AS totalspeed FROM peers WHERE seeder = 'no' AND torrent = '$id'ORDER BY started ASC") or die(mysql_error());
$a = mysql_fetch_assoc($speedQ);
$totalspeed = mksize($a["totalspeed"]) . "/s";
print("<tr><td><B>Speed:</B> $totalspeed</td></tr>");
}
break;
case 'added':
print("<tr><td><B>".DATE_ADDED.":</B> ".date("d-m-Y \\a\\t H:i:s", utc_to_tz_time($row['added']))."</td></tr>");
break;
case 'tracker':
if ($row["external"] == "yes")
print("<tr><td><B>".TRACKER.":</B> ".htmlspecialchars($row["announce"])."</td></tr>");
break;
case 'completed':
print("<tr><td><B>".COMPLETED."</B>: ".$row['times_completed']."</td></tr>");
break;
}
}
print("</table></div></td></tr>\n");
}
//End Expanding Area


}

print("</table><BR>\n");

}

function
pager($rpp, $count, $href, $opts = array()) {
   
$pages = ceil($count / $rpp);

   if (!
$opts["lastpagedefault"])
       
$pagedefault = 0;
   else {
       
$pagedefault = floor(($count - 1) / $rpp);
       if (
$pagedefault < 0)
           
$pagedefault = 0;
   }

   if (isset(
$_GET["page"])) {
       
$page = 0 + $_GET["page"];
       if (
$page < 0)
           
$page = $pagedefault;
   }
   else
       
$page = $pagedefault;

   
$pager = "";

   
$mp = $pages - 1;
   
$as = "<b>&lt;&lt;&nbsp;Prev</b>";
   if (
$page >= 1) {
       
$pager .= "<a href=\"{$href}page=" . ($page - 1) . "\">";
       
$pager .= $as;
       
$pager .= "</a>";
   }
   else
       
$pager .= $as;
   
$pager .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
   
$as = "<b>Next&nbsp;&gt;&gt;</b>";
   if (
$page < $mp && $mp >= 0) {
       
$pager .= "<a href=\"{$href}page=" . ($page + 1) . "\">";
       
$pager .= $as;
       
$pager .= "</a>";
   }
   else
       
$pager .= $as;

   if (
$count) {
       
$pagerarr = array();
       
$dotted = 0;
       
$dotspace = 3;
       
$dotend = $pages - $dotspace;
       
$curdotend = $page - $dotspace;
       
$curdotstart = $page + $dotspace;
       for (
$i = 0; $i < $pages; $i++) {
           if ((
$i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i < $dotend)) {
               if (!
$dotted)
                   
$pagerarr[] = "...";
               
$dotted = 1;
               continue;
           }
           
$dotted = 0;
           
$start = $i * $rpp + 1;
           
$end = $start + $rpp - 1;
           if (
$end > $count)
               
$end = $count;
           
$text = "$start&nbsp;-&nbsp;$end";
           if (
$i != $page)
               
$pagerarr[] = "<a href=\"{$href}page=$i\"><b>$text</b></a>";
           else
               
$pagerarr[] = "<b>$text</b>";
       }
       
$pagerstr = join(" | ", $pagerarr);
       
$pagertop = "<p align=\"center\">$pager<br />$pagerstr</p>\n";
       
$pagerbottom = "<p align=\"center\">$pagerstr<br />$pager</p>\n";
   }
   else {
       
$pagertop = "<p align=\"center\">$pager</p>\n";
       
$pagerbottom = $pagertop;
   }

   
$start = $page * $rpp;

   return array(
$pagertop, $pagerbottom, "LIMIT $start,$rpp");
}

function
commenttable($res) {
global $site_config, $CURUSER, $THEME, $LANGUAGE;  //Define globals

while ($row = mysql_fetch_assoc($res)) {

$postername = htmlspecialchars($row["username"]);
if ($postername == "") {
$postername = "Deluser";
$title = "Deleted Account";
$avatar = "";
$usersignature = "";
$userdownloaded = "";
$useruploaded = "";
}else {
$privacylevel = $row["privacy"];
$avatar = htmlspecialchars($row["avatar"]);
$title =  htmlspecialchars($row["title"]);
$usersignature = stripslashes(format_comment($row["signature"]));
$userdownloaded = mksize($row["downloaded"]);
$useruploaded = mksize($row["uploaded"]);
}

if ($row["downloaded"] > 0)
$userratio = number_format($row["uploaded"] / $row["downloaded"], 2);
else
$userratio = "---";

if (!$avatar)
$avatar = "".$site_config["SITEURL"]."/images/default_avatar.gif";

$commenttext = format_comment($row["text"]);

print("<table border=0 width=100% cellpadding=4>\n");

print("<tr><td colspan=2 align=right class=table_col1>");

if($CURUSER["edit_torrents"]=="yes" || $CURUSER["edit_forum"]=="yes" || $CURUSER['id'] == $row['user']){
print("[<a href=comments.php?id=" . $row["id"] . "&type=torrent&edit=1>edit</a>]&nbsp;");
}
if($CURUSER["delete_torrents"]=="yes" || $CURUSER["delete_forum"]=="yes"){
print("[<a href=comments.php?id=" . $row["id"] . "&type=torrent&delete=1>delete</a>]&nbsp;");
}

print("[<a href=report.php?comment=" . $row["id"] . ">Report</a>]&nbsp;");

print("Posted: ".date("d-m-Y \\a\\t H:i:s", utc_to_tz_time($row['added'])));
print("</td></tr>");

if ($privacylevel != "strong" || ($CURUSER["control_panel"] == "yes")) {
print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername</b><br><i>$title</i></center><br>Uploaded: $useruploaded<br>Downloaded: $userdownloaded<br>Ratio: $userratio<br><br><center><img width=80 height=80 src=$avatar></center><br></td>");
}else{
print("<tr><td valign=top width=150 align=left class=table_col2><center><b>$postername</b><br><i>$title</i></center><br>Uploaded: ---<br>Downloaded: ---<br>Ratio: ---<br><br><center><img width=80 height=80 src=$avatar></center><br></td>");
}
print("<td valign=top width='75%' class=table_col2>$commenttext</td>");
print("</tr></table><BR>\n");
}
}

function
where ($scriptname = "index", $userid){
if (!is_valid_id($userid))
die;
if (preg_match("/torrents-details/i", $scriptname))
$where = "Browsing Torrents Details...";
elseif (preg_match("/torrents/i", $scriptname))
$where = "Browsing Torrent Lists...";
elseif (preg_match("/account-details/i", $scriptname))
$where = "Browsing Account Details...";
elseif (preg_match("/torrents-upload/i", $scriptname))
$where = "Uploading Torrent..";
elseif (preg_match("/account/i", $scriptname))
$where = "Browsing User Control Panel...";
elseif (preg_match("/torrents-search/i", $scriptname))
$where = "Searching...";
elseif (preg_match("/forums/i", $scriptname))
$where = "Browsing Forums...";
elseif (preg_match("/index/i", $scriptname))
$where = "Browsing Homepage...";
else
$where = "Unknown Location...";

$query = sprintf("UPDATE users SET page=".sqlesc($where)." WHERE id ='%s'",
mysql_real_escape_string($userid));
$result = mysql_query($query);

if (!$result)
die;
else
return $where;
}

function
get_user_class_name($i){
$res=mysql_query("SELECT level FROM groups WHERE group_id=".$i."");
$row=mysql_fetch_row($res);
return $row[0];
}

function
get_user_class(){
 global
$CURUSER;
 return
$CURUSER["class"];
}

function
get_ratio_color($ratio) {
if ($ratio < 0.1) return "#ff0000";
if ($ratio < 0.2) return "#ee0000";
if ($ratio < 0.3) return "#dd0000";
if ($ratio < 0.4) return "#cc0000";
if ($ratio < 0.5) return "#bb0000";
if ($ratio < 0.6) return "#aa0000";
if ($ratio < 0.7) return "#990000";
if ($ratio < 0.8) return "#880000";
if ($ratio < 0.9) return "#770000";
if ($ratio < 1) return "#660000";
return "#000000";
}

function
ratingpic($num) {
GLOBAL $site_config;
   
$r = round($num * 2) / 2;
if ($r != $num) {
$n = $num-$r;
if ($n < .25)
$n = 0;
elseif ($n >= .25 && $n < .75)
$n = .5;
$r += $n;
}
   if (
$r < 1 || $r > 5)
       return;

   return
"<img src=\"".$site_config["SITEURL"]."/images/rating/$r.gif\" border=\"0\" alt=\"rating: $num/5\" />";
}



?>


Title: Re: Site integration Mod
Post by: wakewatcher on December 13, 2008, 04:08:08 AM
Quote from: SunKing on May 07, 2008, 02:59:30 AM
Just wanted to say what a great mod this is! It's VERY easy to use!
<snip>
I would be more than happy to attach my (modest) files if anyone is interested. All comments welcomed.

I would be interested in seeing your files.  I've just installed this mod and can get it to display when I click the link in the admin panel but haven't figured out how to add tabs/buttons etc to provide access to my actions/files elsewhere.  Also it appears that LHVWB didn't finish the custom menu mod mentioned (at least I can't find it.)
Title: Re: Site Integration Mod
Post by: [unplugged] on December 13, 2008, 09:43:07 AM
I have attached the file I used as the demo for the mod as seen HERE (http://www.empireofthesun.net/forum/index.php?action=demo). The code may be rudimentary, but it works. ;)
Title: Re: Site Integration Mod
Post by: wakewatcher on December 13, 2008, 04:08:13 PM
Thanks.  This is very helpful.  I do have a somewhat related question.  How would you pull this up from the "home" screen.  I see that if you enter smf with index.php?action=demo then this shows up but once you click on "home" then I don't see how to get back to this demo page again. I thought this is what LHVWB was working on so the actions could be fired from arbitrary pages. Thanks again for your help.
Title: Re: Site Integration Mod
Post by: [unplugged] on December 13, 2008, 04:20:56 PM
once the files (like demo.php) are integrated, you just add a link where you need it (such as in the main menu) which would look something like this:

<a href="', $scripturl, '?action=YOUR_INCLUDE_FILE_NAME">Link Name</a>

where YOUR_INCLUDE_FILE_NAME = the file's name minus the extension. so the link using demo.php would be

<a href="', $scripturl, '?action=demo">Site Integration Demo</a>

Also, Don't forget to add $scripturl to the global. ;)
Title: Re: Site Integration Mod
Post by: wakewatcher on December 13, 2008, 04:27:25 PM
OK so access just by a standard link?  Not a button or icon on the main menu?  Also I must still be missing something as I notice on your demo site that when you enter it via the 'action=demo' that you see your integrated content.  On my site I'm still getting the main forums page and only see it when I hit the demo link on the site integration admin page.  Hmmm...
Title: Re: Site Integration Mod
Post by: wakewatcher on December 13, 2008, 04:29:39 PM
Quote from: SunKing on December 13, 2008, 04:20:56 PM
once the files (like demo.php) are integrated, you just add a link where you need it (such as in the main menu) which would look something like this:

I guess I'm not understanding this either "such as in the main menu"  so you can add links in the main menu?
Title: Re: Site Integration Mod
Post by: [unplugged] on December 13, 2008, 04:31:43 PM
Can you post or PM a link to your site please?
Title: Re: Site Integration Mod
Post by: rhapdog on December 13, 2008, 06:16:09 PM
I have 2 forums using SMF 1.1.7.  Is this mod compatible with 1.1.7?  If not, will there be an update?  I really would like to use this mod, but want an answer on this before I attempt it.
Title: Re: Site Integration Mod
Post by: wakewatcher on December 15, 2008, 08:46:30 PM
[SunKing] Thanks for your help.  Got most of it figured out with your assistence.  Still trying to figure out how to allow only for specific membergroups to trigger action.  Access seems to be only set for guests, regular members and global moderator. (At least the rest of my groups didn't show up on the permissions manage/permissions for the action.)
Title: Re: Site Integration Mod
Post by: wakewatcher on December 16, 2008, 07:13:35 PM
hmmm...  I'm still struggling a bit. Still with the permissions but also I'm trying to figure out how to trigger the action once the member has logged in (not before.)  I see by initiating the page request with index.php?action=actionfile works if permission is granted for guests (i.e. anyone that comes to the page sees the action) however I'm not seeing (or remembering) how to trigger the action once someone signs in.  In my application I don't want guests to see it but will use it for when certain membergroups sign in.
Title: Re: Site Integration Mod
Post by: Nathaniel on December 21, 2008, 05:40:27 AM
@mikeb206 and Dret,
I cannot recreate that error, could you please post a list of the files that you have in those directories? That might help me to work out what it is.

@payme,
By default, the home page should not be enabled. So PortaMx should work, unless there are mod compatibility issues.

@djhowarth,
Its likely that the paths are wrong because they are being loaded from your SMF files. Try using the server path for each of them (eg '/users/myname/public_html/main_site/mysql.php').

@rhapdog,
This mod is compatible with SMF 1.1.7.

@wakewatcher,
I am not entirely sure what you want to do. Do you want to redirect users to a certain action when they log in?
Title: Re: Site Integration Mod
Post by: [unplugged] on December 21, 2008, 09:39:24 AM
Quote from: LHVWB on December 21, 2008, 05:40:27 AM
@wakewatcher,
I am not entirely sure what you want to do. Do you want to redirect users to a certain action when they log in?

When you go into wakewatcher's admin area, where you would select the membergroups allowed to view the action, there are only three membergroups listed (of six). When you go into the main admin page for the mod, it lists all six membergroups as having permission. Therefore, if he wants to disallow permission for group #4, for example, he cannot because only the first 3 groups are listed (with the checkboxes).

Hope that clarifies it a bit. :)
Title: Re: Site Integration Mod
Post by: wakewatcher on December 21, 2008, 02:47:19 PM
Yes that's it.
Title: Re: Site Integration Mod
Post by: Nathaniel on December 21, 2008, 08:47:39 PM
@SunKing and wakewatcher,
Okay, I can see the issue now. Thanks for pointing that out, I will try to work out the exact issue and update the mod when I find some time. ;)
Title: Re: Site Integration Mod
Post by: b4pjoe on January 26, 2009, 02:55:06 PM
I've just installed this mod and I'm having an issue with flashchat. I'm using SMF 2.0. and FlashChat 5.0.10 which is installed into "/chat" withing the SMF folder. When I point the Site Integration to the "/chat" folder it sees the .php files fine and when I save it it makes the actions for each PHP file. The one that runs FlashChat is "flashchat.php". When I click the link for it I get an error:

Fatal error: Cannot redeclare reloadsettings() (previously declared in /pathtomysite/forum/Sources/Load.php:140) in /pathtomysite/forum/Sources/Load.php on line 301[/code]

Any help would be greatly appreciated.?

PS: If I run the FlashChat as standalone using the normal URL it works fine.
Title: Re: Site Integration Mod
Post by: Nathaniel on January 26, 2009, 06:34:38 PM
@joec88,
That sounds like an issue with common function names between SMF and your chat program. PHP doesn't allow you to define more than one function with the same name (when you included that file from SMF), so it returns that error.

You should be able to fix it by renaming that function from you 'flashchat.php' file to something like 'flash_reloadsettings', although that will require you to change the name for every time it is called within the flashchat script, otherwise it might have bugs.
Title: Re: Site Integration Mod
Post by: b4pjoe on January 26, 2009, 08:06:42 PM
Quote from: LHVWB on January 26, 2009, 06:34:38 PM
@joec88,
That sounds like an issue with common function names between SMF and your chat program. PHP doesn't allow you to define more than one function with the same name (when you included that file from SMF), so it returns that error.

You should be able to fix it by renaming that function from you 'flashchat.php' file to something like 'flash_reloadsettings', although that will require you to change the name for every time it is called within the flashchat script, otherwise it might have bugs.

Thanks for the reply. Line 301 of Load.php is just "{" so I assume the function call is the previous lines which is:


call_user_func($modSettings['integrate_pre_load']);


I can't find that block of code in FlashChat anywhere.
Title: Re: Site Integration Mod
Post by: [unplugged] on January 26, 2009, 08:30:40 PM
It's not going to be line 301 of Load.php. It's going to be line 301 of the file Load.php is loading.  ;D
Title: Re: Site Integration Mod
Post by: b4pjoe on January 26, 2009, 08:46:53 PM
Quote from: SunKing on January 26, 2009, 08:30:40 PM
It's not going to be line 301 of Load.php. It's going to be line 301 of the file Load.php is loading.  ;D

Thanks for the reply.

How would I find out what that is?
Title: Re: Site Integration Mod
Post by: [unplugged] on January 26, 2009, 08:57:19 PM
One rather rudimentary way would be to search all the files (at once, of course ;)) for all instances of reloadsettings(). There should only be 2 instances of it come up. One of them will be on line 301.  :P

That will put you closer to a solution anyway. Why would you want to call the FlashChat thru the site integration mod when the direct URL works? Just curious. I have used a "dummy" file inside my includes folder for the integration mod which simply contained require ('/myprog/myprog.php'); then i could link to ?action=dummy or whatever. That approach does not work in all cases, but you may want to give it a try.
Title: Re: Site Integration Mod
Post by: b4pjoe on January 26, 2009, 09:02:19 PM
I was wanting to display the chat inside the forum the way it used to with the mod that no longer works with this version of SMF/FlashChat. (If that makes sense).

Thanks for the other info, I will try those suggestions and see what happens.

Edit: I've searched the files for reloadsettings(). I found 3 instances of it in SMF: SSI.php, index.php (both in the forums folder) and Load.php in the Sources folder. I found no files in the FlashChat folder that have it.
Title: Re: Site Integration Mod
Post by: wakewatcher on February 07, 2009, 12:36:38 AM
Quote from: LHVWB on December 21, 2008, 08:47:39 PM
@SunKing and wakewatcher,
Okay, I can see the issue now. Thanks for pointing that out, I will try to work out the exact issue and update the mod when I find some time. ;)

@LHVWB

Curious did you ever have chance to look at this?  -thx-
Title: Re: Site Integration Mod
Post by: ke4obt on February 08, 2009, 02:54:11 PM
I'm trying to figure out how to go about using HamWeather with our SMF site. The HamWeather pages call a header and a footer as well as the header calls a navbar once the body tags start.
I am hoping I can use the Site Integration mod to do this. I tried on one of my other test sites - without Site Integration , but when I went to the HamWeather page, I basically lost my site's navbar, etc. and it was only the HamWeather. So basically, it didn't "wrap" the pages into the site. (if that makes sense). I do NOT want the header or the footer for HamWeather in our site (the HamWeather copyright would be put in the footer of the SMF site, along with the other copyrights). I DO want the navigation bar. It appears the navbar would be across the top, I'd rather have it in the body, down the left side - like SMF does when you're in the Admin panel.
There IS a main php file in HamWeather (in it's root folder), then it seems the rest of the pages are in html.
Here is where the download section for HamWeather is. http://www.hamweather.com/hw3/hw3php/download.shtml (http://www.hamweather.com/hw3/hw3php/download.shtml)  I downloaded the .zip file for php/MySql since my site is on a linux server. I didn't get the flatfile.
If anyone can point me in the direction I need to go to get this to work, I will appreciate it greatly!!!

Thanks in advance,
Title: Re: Site Integration Mod
Post by: onlybrian on February 24, 2009, 02:45:13 AM
Hello,

I changed the default to something else and am using the action=forum to access the forum. Whenever I view any page inside the forum, like topics, the menu doesn't seem to recognize it's still the forum since the address no longer supply action=forum. How am I suppose to correct this problem? Thanks in advance.

- Brian
Title: Re: Site Integration Mod
Post by: Eclipse16V on March 10, 2009, 01:55:23 AM
Why does it not run under SMF 2.0 RC1  :-[
Title: Re: Site Integration Mod
Post by: Ncen on March 10, 2009, 07:31:41 PM
I tried searching for an answer in this topic, but i missed it or ther isn't an answer yet. ^^

1. For Who's online, when i have checked the "Show in Whosonline list?" box, it shows the title on the the Who's online-page, but could i somehow make it say : Looking at [title of the page] and possibly make that a link to the page/action? without manually adding a textstring everytime? :)

2. Also, i wonder if it's possible to have it pre-select permission for some user-groups for each action/page? the ids of those are: 9, 11, 13, 14? I would then if i want one page non-viewable go and unselect? that would save lots and lots of time. :)

Thanks. :)



Using 1.1.8
Title: Re: Site Integration Mod
Post by: pendusingh on May 16, 2009, 08:11:11 PM
guys i installed "FlashChat Integration" it installl alrite... did not had anny failing error or missing files... but right after i installed it, i go to home page i get this error.....

Fatal error: require_once() [function.require]: Failed opening required 'INC_DIR../config.srv.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/p/e/n/pendubande1/html/chat/inc/config.srv.php on line 2


any help ???? would apricate about it..

thanks in advance....

Title: Re: Site Integration Mod
Post by: bschhikara on May 23, 2009, 08:35:35 PM
Hi

I've just updated my forum from 2.0 Beta 4 to 2.0 RC1 using the upgrade. The upgrade worked okay and I can access all boards and menu links. but i am not able to access Admin menu link. It is showing following message:

Fatal error: Cannot redeclare template_siteintegrationsettings() (previously declared in pathtoforum/Sources/Load.php(1927) : eval()'d code:1969) in pathtoforum/Sources/Load.php(1927) : eval()'d code on line 1981

how can I access admin menu. I will reinstall site integration mode on access of admin cpanel.

bhupender
Title: Re: Site Integration Mod
Post by: Chit-Chat ChatterBox Boss on June 04, 2009, 03:25:23 PM
Catching these errors:


2: Invalid argument supplied for foreach()
File: /home/XXXXXX/public_html/Sources/Who.php
Line: 331



8: Undefined index:  siteintegration_actions
File: /home/XXXXXX/public_html/Sources/Who.php
Line: 331
Title: Re: Site Integration Mod
Post by: Chit-Chat ChatterBox Boss on June 05, 2009, 01:02:48 AM
Someone gave me a solution to this problem on SMF Helper.

Find:
   //   Add the included actions/files for the Site Integration Mod.
   foreach($context['siteintegration_actions'] as $action => $data)

Replace with:
   if (!empty($context['siteintegration_actions']))
   {

   //   Add the included actions/files for the Site Integration Mod.
   foreach($context['siteintegration_actions'] as $action => $data)


Find:
         //   Add the permisions for this action.
         $allowedActions[$action] = array('SiteIntegration:'.$action);
      }
   }

Replace with:
         //   Add the permisions for this action.
         $allowedActions[$action] = array('SiteIntegration:'.$action);
      }
   }
   }
Title: Re: Site Integration Mod
Post by: Sordell Media on August 13, 2009, 02:11:11 AM
Does anyone know if this works under 2.0 RC1.2? I'm looking to start work on a new project shortly that will require a fair amount of integration with SMF, and think this mod would be an excellent aide in getting setup, but the mods site still lists it as only supporting beta 4.
Title: Re: Site Integration Mod
Post by: ScottDB on August 13, 2009, 01:25:52 PM
Hi all, This sounds like a great mod. What I would like to know is if this can be used or modified so that I can have my SMF login and signup integrated into my LFM login and signup. Would have to keep the LFM signup and Login in tact since it is a php based affiliate software that I have in the subfolders of my forum.
Title: Re: Site Integration Mod
Post by: espressoguy on September 20, 2009, 02:16:03 AM
After installing this mod (over 1.1.6) I don't have a  "Features and Options" section-> "Site Integration" tab

    ...I just have "Basic Features", "Layout and Options", and "Karma" tabs.

    So how do I use this mod?
Title: Re: Site Integration Mod
Post by: onlybrian on December 14, 2009, 04:26:42 AM
This is a very helpful mod, would appreciate latest update. Thanks
Title: Re: Site Integration Mod
Post by: ChaosEnergy on December 27, 2009, 11:47:26 AM
will there be an 2. rc2 compatible version
Title: Re: Site Integration Mod
Post by: [unplugged] on February 01, 2010, 02:11:21 AM
I have installed this on a site running RC2 using the parser and everything works fine. Just followed the steps one by one just as they are listed. The only one that I had to change slightly was adding the help $txt strings. The line that the parser was searching for wasn't there, so I added the block to the end of the file (just before the ?>). There are one or two other very minor theme issues such as spacing, but nothing that broke the forum. Works like a charm.

EDIT: Make that two sites running RC2, the latter having several other mods and a custom theme. It's really an easy manual edit. Also, make sure to clear your site's cache so that the language strings show properly.
Title: Re: Site Integration Mod
Post by: Siirist on March 30, 2010, 01:32:51 PM
Quote from: SunKing on February 01, 2010, 02:11:21 AM
I have installed this on a site running RC2 using the parser and everything works fine. Just followed the steps one by one just as they are listed. The only one that I had to change slightly was adding the help $txt strings. The line that the parser was searching for wasn't there, so I added the block to the end of the file (just before the ?>). There are one or two other very minor theme issues such as spacing, but nothing that broke the forum. Works like a charm.

EDIT: Make that two sites running RC2, the latter having several other mods and a custom theme. It's really an easy manual edit. Also, make sure to clear your site's cache so that the language strings show properly.

Hi,

We have the thought of (liking the theme we are using on SMF ver 2.0 RC3)
as a possible background on our website
(sounds like that is what this mod is going to do).  ;D



These don't work  :(

Demo Sites:
SMF 1.1.5: http://www.verbtest.com/smfdemo/index.php
SMF 2 Beta: http://www.verbtest.com/smf2demo/index.php



So, SunKing, could we see yours? or is there another example somewhere that is live?  ???



As we said above, we are running SMF ver 2.0 RC3, but we saw that the parser will give the codes to do the whole thing "by hand", or do you think that we can just use the package manager?  ::)



Thanks in advance.  O:)

Be Well,
Cloud  8)
Title: Re: Site Integration Mod
Post by: [unplugged] on March 30, 2010, 05:00:51 PM
http://www.empireofthesun.net/forum/index.php?action=demo


I have a file called demo.php with the code in it that you see shown when going to ?action=demo in the link above.
Title: Re: Site Integration Mod
Post by: Siirist on March 31, 2010, 12:42:45 PM
SunKing,

All I can say about this is


WOW!!!!


It seems like an entire program!!  :o
Is it written in Java Script? Because I know quite a bit of html (ok, that is old), am learning xhtml (I think), and trying CSS (which is nice when there is a single change to many pages).   ::)

That said, and seeing all there is, I wonder if the mod is "above me".  Can't even begin to imagine how to "work" it.  :-\


It seems that it goes FAR BEYOND a portal I've seen.
Again, WOW!!!  ;D


So, is it that the "top" of the page is unchanging but when going to another page the bottom changes?  ???

Should I fake it till I make it?  ???

Awaiting you words of wisdom.  ;)

Be Well,
Cloud 8)
Title: Re: Site Integration Mod
Post by: [unplugged] on March 31, 2010, 01:33:03 PM
Basically, this mod is what puts everything between the Forum >> Some page >> Another page navigation and the copyright in the footer. It can handle many file types and essentially just executes whatever scripts may be inside those files.

A quick example:

I create a file named cloud.html. In that file I have <span style="color:red;">WOW!!!!</span>. I add cloud.html to a folder that I have listed in the admin for this mod. I set the permissions for the membergroups I want to be able to use it. Now, when one of those groups navigates to ?action=cloud (through a link, menu button, or whatever), it will display    WOW!!!!   in the forum for them. Now, the possibilities are endless. You could set up any type of script in many programming languages. html, xhtml, php, even txt. You simply drop the file into the assigned folder and set the permissions. Instant ?action=filename.
Title: Re: Site Integration Mod
Post by: Siirist on March 31, 2010, 02:15:12 PM
SunKing,

Thank you for your quick reply.  ;D

So, here's what I / we are wanting.

There is a theme titled Bright Forest (http://custom.simplemachines.org/themes/index.php?lemma=336) that was created by Aäron.

We are still working on what we want as a "logo" or "look" at A Sanctuary (http://www.asanctuary.net) / Your Sanctuary (http://www.asanctuary.net/yoursanctuary/index.php).

We are considering using Bright Forest as a background for our "home page" at our "website" A Sanctuary.
This will be with permission from and credit to Aäron.  O:)

We have already posted a request in the support topic of Bright Forest that we want to change the "title" words of Bright Forest.

We would like to add to the background
Your Sanctuary for the forum
and
A Sanctuary for the "website"  ::)

Can this mod do that?  ???

Cloud 8)
Title: Re: Site Integration Mod
Post by: coaster3000 on April 08, 2010, 03:43:23 PM
This one edit / file edit thing cant be performed on smf V 2.0 RC3


Execute Modification  ./Themes/default/languages/Help.english.php  Test failed
1. Add After ./Themes/default/languages/Help.english.php Test failed


I believe it cant find the text its adding it after. Basically RC3 must have something different then search code for install. Can you update this mod to have this fixed thanks  ;D
Title: Re: Site Integration Mod
Post by: Siirist on May 21, 2010, 11:11:52 AM
Um, bump
Title: Re: Site Integration Mod
Post by: Siirist on June 02, 2010, 04:46:08 PM
Quote from: A Cloud Walker on May 21, 2010, 11:11:52 AM
Um, bump

Bump

Cloud 8)
Title: Re: Site Integration Mod
Post by: Siirist on June 07, 2010, 07:59:19 PM
push?
Title: Re: Site Integration Mod
Post by: Siirist on June 07, 2010, 08:11:16 PM
Quote from: A Cloud Walker on June 02, 2010, 04:46:08 PM
Quote from: A Cloud Walker on May 21, 2010, 11:11:52 AM
Um, bump

Bump

Cloud 8)


um, push?
Title: Re: Site Integration Mod
Post by: Siirist on June 16, 2010, 03:06:36 AM
Anyone?
Title: Re: Site Integration Mod
Post by: RCC_SaMiaM on July 11, 2011, 02:16:45 PM
This topic seems to be dead but I am hoping someone knows why this is happening - I installed it on 2.0 and it works fine except for one thing.  When you access the root of the domain, www.whatever.com or www.whatever.com/index.php it gets stuck in a redirection loop.  So this must be something to do with the part of the mod where you can change your home.
Title: Re: Site Integration Mod
Post by: RCC_SaMiaM on July 11, 2011, 02:30:11 PM
I know this isn't fixing the issue, but this fixes the problem if you aren't trying to make a different page your home page for the forum. 

Find in index.php (main index page in root)
$load_home = true;

and replace it with
require_once($sourcedir . '/BoardIndex.php');
return 'BoardIndex';


I suspect it has something to do where it is checking if $load_home is false, there must be something incorrect about the conditions.  I might look into this later, but this is a quick fix.
Title: Re: Site Integration Mod
Post by: Apllicmz on October 07, 2012, 05:24:17 PM
Any Update for 2.0.2 .thanks
Title: Re: Site Integration Mod
Post by: live627 on June 10, 2021, 07:10:42 PM
I recently discovered this mod and after modifying it for my needs (using integration hooks so that I don't need to fuss over tracking many file edits) have used it to consolidate five mods, including a portal (which was just used as a landing page).
Title: Re: Site Integration Mod
Post by: live627 on October 27, 2021, 06:56:24 PM
2.0.0 (2021-10-27)

⚠ BREAKING CHANGES

Features

Bug Fixes

Code Refactoring
Title: Re: Site Integration Mod
Post by: live627 on April 17, 2022, 02:02:53 AM
2.0.1 (2022-04-17)

Bug Fixes
Title: Re: Site Integration Mod
Post by: live627 on July 07, 2022, 08:00:02 PM
@Avid Gamer can you post the last several errors from the PHP error log file?