Advertisement:

Author Topic: [1.x] SSI manager  (Read 118903 times)

Offline Robert.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,074
  • Gender: Male
    • nedroden on GitHub
[1.x] SSI manager
« on: June 03, 2011, 05:04:15 AM »
Hey :)
Having issues with creating pages for 1.x? Well, Dr. Deejay comes with a solution: the SSI manager. It is a very simple script that displays custom pages. I'll explain how it works: first of all, create a directory named "pages" in the root of your forum. Then upload the attached file into the root of your forum too. You can create new pages by adding new files, like:
1.php
2.php
3.php
Make sure your file is .php. You can access pages by site.php?page=pagetitle. Make sure too that you add this in every page:
Code: [Select]
<?php
$context
['page_title'] = 'Pagetitle';
$ssi_gzip false or true;
$ssi_ban false or true;
$ssi_content 'Page content';
And change $ssi_gzip = false or true and $ssi_ban = false or true to "false" or "true". Here is an example:
Code: [Select]
<?php
$context
['page_title'] = 'My first page!';
$ssi_gzip true;
$ssi_ban false;
$ssi_content 'Just my first page!';
Enjoy! :)
Software Engineering student
DraiWiki | Project Alpha

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,917
  • Gender: Male
Re: [1.x] SSI manager
« Reply #1 on: June 03, 2011, 02:05:58 PM »
You should add this to your script for inexperienced users.

Code: [Select]
if (isset($smcFunc['db_query']))
die ('Sorry, this script is not compatible with SMF 2.0');
« Last Edit: June 05, 2011, 03:33:26 AM by Masterd »

Offline Anthony`

  • Sophist Member
  • *****
  • Posts: 1,347
  • Gender: Male
  • Formerly Project Evolution
    • AnthonyCalandra on GitHub
Re: [1.x] SSI manager
« Reply #2 on: June 04, 2011, 11:58:04 PM »
Quite an idea, havnt heard of one myself. Have a couple suggestions though. :P

First one, I think the path you have set for inclusion in the script doesnt work the way its supposed to. When I try to access a file by URL the file_exists() function gives me a false result each time. I have a fix here below,
Code: [Select]
$file = getcwd() . '/' . $_GET['page'] . '.php';
if (file_exists($file))
include($file);
else
die("Undefined page");

The code is also very exploitable. I can include files from previous directories and such other than pages, so might want to fix that.

Offline Robert.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,074
  • Gender: Male
    • nedroden on GitHub
Re: [1.x] SSI manager
« Reply #3 on: June 05, 2011, 05:41:04 AM »
You should add this to your script for inexperienced users.

Code: [Select]
if (isset($smcFunc['db_query']))
die ('Sorry, this script is not compatible with SMF 2.0');
Added, thanks ;D
Quite an idea, havnt heard of one myself. Have a couple suggestions though. :P

First one, I think the path you have set for inclusion in the script doesnt work the way its supposed to. When I try to access a file by URL the file_exists() function gives me a false result each time. I have a fix here below,
Code: [Select]
$file = getcwd() . '/' . $_GET['page'] . '.php';
if (file_exists($file))
include($file);
else
die("Undefined page");
Danke, added ;D
Quote
I can include files from previous directories and such other than pages, so might want to fix that.
Fixed, thanks for reporting. =)

*uploading new version*

Wtf I cannot add new attachments in this board o_O
Software Engineering student
DraiWiki | Project Alpha

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,917
  • Gender: Male
Re: [1.x] SSI manager
« Reply #4 on: June 05, 2011, 09:51:40 AM »
Wtf I cannot add new attachments in this board o_O


That feature is disabled in this board.

Offline digitalmikey

  • Semi-Newbie
  • *
  • Posts: 91
Re: [1.x] SSI manager
« Reply #5 on: July 05, 2011, 02:47:29 PM »
How can I do this in 2.0?