Advertisement:

Navigation

Readme

This will install SimplePortal 2.3.1 for SMF 2.0.

File Edits

./index.php

Find: [Select]
require_once($sourcedir . '/Security.php');
Replace With: [Select]
require_once($sourcedir . '/Security.php');
require_once($sourcedir . '/Subs-Portal.php');

Find: [Select]
// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum'))
Replace With: [Select]
// Load SimplePortal.
sportal_init();

// Is the forum in maintenance mode? (doesn't apply to administrators.)
if (!empty($maintenance) && !allowedTo('admin_forum'))

Find: [Select]
empty($modSettings['allow_guestAccess'])
Replace With: [Select]
empty($modSettings['allow_guestAccess']) && !(!empty($_REQUEST['action']) && $_REQUEST['action'] == 'dlattach' && !empty($_REQUEST['type']) && $_REQUEST['type'] == 'avatar') && !(empty($_REQUEST['action']) && empty($board) && empty($topic) && $modSettings['sp_portal_mode'] == 1)
Find: [Select]
// Action and board are both empty... BoardIndex!
Replace With: [Select]
// Go catch it boy! Catch it!
$sp_action = sportal_catch_action();
if ($sp_action)
return $sp_action;

// Action and board are both empty... BoardIndex!

Find: [Select]
'findmember' => array('Subs-Auth.php', 'JSMembers'),
Replace With: [Select]
'findmember' => array('Subs-Auth.php', 'JSMembers'),
'forum' => array('BoardIndex.php', 'BoardIndex'),
'portal' => array('PortalMain.php', 'sportal_main'),

Find: [Select]
if (empty($_REQUEST['action']) ||
Replace With: [Select]
if (empty($_REQUEST['action']) || !($_REQUEST['action'] == 'portal' && isset($_GET['xml'])) &&
Find: [Select]
// Get the function and file to include - if it's not there, do the board index.
Replace With: [Select]
if (!empty($context['disable_sp']))
unset($actionArray['portal'], $actionArray['forum']);

// Get the function and file to include - if it's not there, do the board index.

./SSI.php

Find: [Select]
require_once($sourcedir . '/Security.php');
Replace With: [Select]
require_once($sourcedir . '/Security.php');
require_once($sourcedir . '/Subs-Portal.php');

Find: [Select]
loadPermissions();
Replace With: [Select]
loadPermissions();

// Load some SP stuff.
sportal_init();

./Sources/Admin.php

Find: [Select]
),
'members' => array(
Replace With: [Select]
),
'portal' => array(
'title' => $txt['sp-adminCatTitle'],
'permission' => array('sp_admin', 'sp_manage_settings', 'sp_manage_blocks', 'sp_manage_articles', 'sp_manage_pages', 'sp_manage_shoutbox'),
'areas' => array(
'portalconfig' => array(
'label' => $txt['sp-adminConfiguration'],
'file' => 'PortalAdminMain.php',
'function' => 'sportal_admin_config_main',
'icon' => 'configuration.png',
'permission' => array('sp_admin', 'sp_manage_settings'),
'subsections' => array(
'information' => array($txt['sp-info_title']),
'generalsettings' => array($txt['sp-adminGeneralSettingsName']),
'blocksettings' => array($txt['sp-adminBlockSettingsName']),
'articlesettings' => array($txt['sp-adminArticleSettingsName']),
),
),
'portalblocks' => array(
'label' => $txt['sp-blocksBlocks'],
'file' => 'PortalAdminBlocks.php',
'function' => 'sportal_admin_blocks_main',
'icon' => 'blocks.png',
'permission' => array('sp_admin', 'sp_manage_blocks'),
'subsections' => array(
'list' => array($txt['sp-adminBlockListName']),
'add' => array($txt['sp-adminBlockAddName']),
'left' => array($txt['sp-positionLeft']),
'top' => array($txt['sp-positionTop']),
'bottom' => array($txt['sp-positionBottom']),
'right' => array($txt['sp-positionRight']),
),
),
'portalarticles' => array(
'label' => $txt['sp-adminColumnArticles'],
'file' => 'PortalAdminArticles.php',
'function' => 'sportal_admin_articles_main',
'icon' => 'articles.png',
'permission' => array('sp_admin', 'sp_manage_articles'),
'subsections' => array(
'articles' => array($txt['sp-adminArticleListName']),
'addarticle' => array($txt['sp-adminArticleAddName']),
'categories' => array($txt['sp-adminCategoryListName']),
'addcategory' => array($txt['sp-adminCategoryAddName']),
),
),
'portalpages' => array(
'label' => $txt['sp_admin_pages_title'],
'file' => 'PortalAdminPages.php',
'function' => 'sportal_admin_pages_main',
'icon' => 'pages.png',
'permission' => array('sp_admin', 'sp_manage_pages'),
'subsections' => array(
'list' => array($txt['sp_admin_pages_list']),
'add' => array($txt['sp_admin_pages_add']),
),
),
'portalshoutbox' => array(
'label' => $txt['sp_admin_shoutbox_title'],
'file' => 'PortalAdminShoutbox.php',
'function' => 'sportal_admin_shoutbox_main',
'icon' => 'shoutbox.png',
'permission' => array('sp_admin', 'sp_manage_shoutbox'),
'subsections' => array(
'list' => array($txt['sp_admin_shoutbox_list']),
'add' => array($txt['sp_admin_shoutbox_add']),
),
),
),
),
'members' => array(

Find: [Select]
'ManageSearchEngines', 'ManageServer', 'ManageSmileys',
Replace With: [Select]
'ManageSearchEngines', 'ManageServer', 'ManageSmileys', 'PortalAdminMain',
Find: [Select]
foreach ($settings_search as $setting_area)
Replace With: [Select]
// We are more than "real freaking good" Grudge. ;P
$settings_search = array_merge($settings_search, array(
array('sportal_admin_general_settings', 'area=portalconfig;sa=generalsettings'),
array('sportal_admin_block_settings', 'area=portalconfig;sa=blocksettings'),
array('sportal_admin_article_settings', 'area=portalconfig;sa=articlesettings'),
));

foreach ($settings_search as $setting_area)

./Sources/Display.php

Find: [Select]
// Is this topic sticky, or can it even be?
Replace With: [Select]
// Is this already an article?
$request = $smcFunc['db_query']('','
SELECT id_message
FROM {db_prefix}sp_articles
WHERE id_message = {int:message}',
array(
'message' => $context['topic_first_message'],
)
);
list ($context['topic_is_article']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

// Is this topic sticky, or can it even be?

./Sources/Help.php

Find: [Select]
// Load the admin help language file and template.
loadLanguage('Help');
Replace With: [Select]
// Load the admin help language file and template.
loadLanguage('Help');
// Load the Simple Portal Help file.
loadLanguage('SPortalHelp', sp_languageSelect('SPortalHelp'));

./Sources/Load.php

Find: [Select]
// Verify the id_theme... no foul play.
Replace With: [Select]
global $sp_standalone;

// Maybe we have a portal specific theme?
if (!isset($_GET['action']) && !isset($_GET['board']) && !isset($_GET['topic']) && ($modSettings['sp_portal_mode'] == 1 || !empty($sp_standalone)) && !empty($modSettings['portaltheme']))
$id_theme = (int) $modSettings['portaltheme'];

// SMF doesn't seem to be liking -1...
if ($id_theme == -1 && !empty($_SESSION['id_theme']))
{
unset($_SESSION['id_theme']);
$id_theme = $modSettings['theme_guests'];
}

// Verify the id_theme... no foul play.

Find: [Select]
// Wireless mode? Load up the wireless stuff.
Replace With: [Select]
// We'll be on the safe side, and load our language here!
loadLanguage('SPortal', '', false);
$cur_language = isset($user_info['language']) ? $user_info['language'] : $language;
if ($cur_language !== 'english')
loadLanguage('SPortal', 'english', false);

// Wireless mode? Load up the wireless stuff.

./Sources/ManagePermissions.php

Find: [Select]
'pm_read' => array(false, 'pm', 'use_pm_system'),
Replace With: [Select]
'pm_read' => array(false, 'pm', 'use_pm_system'),
'sp_admin' => array(false, 'sp', 'sp'),
'sp_manage_settings' => array(false, 'sp', 'sp'),
'sp_manage_blocks' => array(false, 'sp', 'sp'),
'sp_manage_articles' => array(false, 'sp', 'sp'),
'sp_manage_pages' => array(false, 'sp', 'sp'),
'sp_manage_shoutbox' => array(false, 'sp', 'sp'),
'sp_add_article' => array(false, 'sp', 'sp'),
'sp_auto_article_approval' => array(false, 'sp', 'sp'),

Find: [Select]
'pm',
Replace With: [Select]
'pm',
'sp',

Find: [Select]
'use_pm_system',
Replace With: [Select]
'use_pm_system',
'sp',

./Sources/ManageServer.php

Find: [Select]
loadLanguage('Help');
Replace With: [Select]
loadLanguage('Help');
loadLanguage('SPortalHelp', sp_languageSelect('SPortalHelp'));

./Sources/QueryString.php

Find: [Select]
// If $scripturl is set to nothing, or the SID is not defined (SSI?) just quit.
Replace With: [Select]
// It's just a blue dream...
if (function_exists('sp_query_string'))
$buffer = sp_query_string($buffer);

// If $scripturl is set to nothing, or the SID is not defined (SSI?) just quit.

./Sources/Recent.php

Find: [Select]
'href' => $scripturl . '#c' . $row['id_cat'],
'link' => '<a href="' . $scripturl . '#c' . $row['id_cat'] . '">' . $row['cname'] . '</a>'
Replace With: [Select]
'href' => $scripturl . '?action=forum#c' . $row['id_cat'],
'link' => '<a href="' . $scripturl . '?action=forum#c' . $row['id_cat'] . '">' . $row['cname'] . '</a>'

Find: [Select]
'url' => $scripturl . '#c' . (int) $_REQUEST['c'],
Replace With: [Select]
'url' => $scripturl . '?action=forum#c' . (int) $_REQUEST['c'],
Find: [Select]
'url' => $scripturl . '#c' . (int) $_REQUEST['c'][0],
Replace With: [Select]
'url' => $scripturl . '?action=forum#c' . (int) $_REQUEST['c'][0],

./Sources/Subs.php

Find: [Select]
static $disabled;
Replace With: [Select]
static $disabled, $parse_tag_cache;
Find: [Select]
// If we are not doing every tag then we don't cache this run.
if (!empty($parse_tags) && !empty($bbc_codes))
{
$temp_bbc = $bbc_codes;
$bbc_codes = array();
}
Replace With: [Select]
/*
// If we are not doing every tag then we don't cache this run.
if (!empty($parse_tags) && !empty($bbc_codes))
{
$temp_bbc = $bbc_codes;
$bbc_codes = array();
}
*/

Find: [Select]
if (empty($bbc_codes) || $message === false || !empty($parse_tags))
Replace With: [Select]
// if (empty($bbc_codes) || $message === false || !empty($parse_tags))
// I wish I didn't had to do this... puff...
if (empty($bbc_codes) || $message === false)

Find: [Select]
if (empty($parse_tags) || in_array($code['tag'], $parse_tags))
$bbc_codes[substr($code['tag'], 0, 1)][] = $code;
}
$codes = null;
}
Replace With: [Select]
// if (empty($parse_tags) || in_array($code['tag'], $parse_tags))
$bbc_codes[substr($code['tag'], 0, 1)][] = $code;
}
$codes = null;
}

if ($parse_tags !== array() && is_array($parse_tags))
{
$temp_bbc = $bbc_codes;
$tags_cache_id = implode(',', $parse_tags);

if (isset($parse_tag_cache[$tags_cache_id]))
$bbc_codes = $parse_tag_cache[$tags_cache_id];
else
{
foreach ($bbc_codes as $key_bbc => $bbc)
foreach ($bbc as $key_code => $code)
if (!in_array($code['tag'], $parse_tags))
unset($bbc_codes[$key_bbc][$key_code]);

$parse_tag_cache = array($tags_cache_id => $bbc_codes);
}
}

Find: [Select]
'admin_forum', 'manage_boards'
Replace With: [Select]
'admin_forum', 'manage_boards', 'sp_admin', 'sp_manage_settings', 'sp_manage_blocks', 'sp_manage_articles', 'sp_manage_pages', 'sp_manage_shoutbox'
Find: [Select]
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
Replace With: [Select]
'home' => array(
'title' => $txt['home'],
'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'forum' => array(
'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],
'href' => $scripturl . ($modSettings['sp_portal_mode'] == 1 && empty($context['disable_sp']) ? '?action=forum' : ''),
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
'sub_buttons' => array(
),
),
This operation isn't vital to the installation of this mod.

Find: [Select]
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
Replace With: [Select]
'home' => array(
'title' => $txt['home'],
'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
'forum' => array(
'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],
'href' => $scripturl . ($modSettings['sp_portal_mode'] == 1 && empty($context['disable_sp']) ? '?action=forum' : ''),
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
'sub_buttons' => array(
),
),
This operation isn't vital to the installation of this mod.

Find: [Select]
$add = preg_match('~^(ftp|http)[s]?://~', $setLocation) == 0 && substr($setLocation, 0, 6) != 'about:';
Replace With: [Select]
$add = preg_match('~^(ftp|http)[s]?://~', $setLocation) == 0 && substr($setLocation, 0, 6) != 'about:';

// Redirect to the forums action not the portal, when Simple Portal is active. ;)
if ((empty($setLocation) || $scripturl == $setLocation) && $modSettings['sp_portal_mode'] == 1 && empty($modSettings['sp_disableForumRedirect']))
$setLocation = 'action=forum';

Find: [Select]
$current_action = 'home';
Replace With: [Select]
$current_action = $modSettings['sp_portal_mode'] == 3 && empty($context['standalone']) && empty($context['disable_sp']) ? 'forum' : 'home';
Find: [Select]
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
Replace With: [Select]
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';
elseif(empty($context['disable_sp']) && ((isset($_GET['board']) || isset($_GET['topic']) || in_array($context['current_action'], array('unread', 'unreadreplies'))) && in_array($modSettings['sp_portal_mode'], array(1, 3))))
$current_action = 'forum';

./Sources/Subs-BoardIndex.php

Find: [Select]
'href' => $scripturl . '#c' . $row_board['id_cat'],
Replace With: [Select]
'href' => $scripturl . '?action=forum#c' . $row_board['id_cat'],

./Sources/Subs-Boards.php

Find: [Select]
if (isset($_SESSION['topicseen_cache']))
$_SESSION['topicseen_cache'] = array();

redirectexit();
Replace With: [Select]
if (isset($_SESSION['topicseen_cache']))
$_SESSION['topicseen_cache'] = array();

redirectexit('action=forum');

./Sources/Who.php

Find: [Select]
// Actions that require a specific permission level.
Replace With: [Select]
if ($modSettings['sp_portal_mode'] == 1)
{
$txt['who_index'] = $txt['sp_who_index'];
$txt['whoall_forum'] = $txt['sp_who_forum'];
}

// Actions that require a specific permission level.

Find: [Select]
$board_ids = array();
Replace With: [Select]
$board_ids = array();
$page_ids = array();

Find: [Select]
// It's the board index!! It must be!
Replace With: [Select]
elseif (isset($actions['page']))
{
$data[$k] = $txt['who_hidden'];
$page_ids[$actions['page']][$k] = $txt['sp_who_page'];
}
// It's the board index!! It must be!

Find: [Select]
// Load member names for the profile.
Replace With: [Select]
if (!empty($page_ids))
{
$numeric_ids = array();
$string_ids = array();
$page_where = array();

foreach ($page_ids as $page_id => $dummy)
if (is_numeric($page_id))
$numeric_ids[] = (int) $page_id;
else
$string_ids[] = $page_id;

if (!empty($numeric_ids))
$page_where[] = 'id_page IN ({array_int:numeric_ids})';

if (!empty($string_ids))
$page_where[] = 'namespace IN ({array_string:string_ids})';

$result = $smcFunc['db_query']('', '
SELECT id_page, namespace, title, allowed_groups, permission_type
FROM {db_prefix}sp_pages
WHERE ' . implode(' OR ', $page_where) . '
LIMIT {int:limit}',
array(
'numeric_ids' => $numeric_ids,
'string_ids' => $string_ids,
'limit' => count($page_ids),
)
);
$page_data = array();
while ($row = $smcFunc['db_fetch_assoc']($result))
{
if (!sp_allowed_to('page', $row['id_page'], $row['allowed_groups'], $row['permission_type']))
continue;

$page_data[] = array(
'id' => $row['id_page'],
'namespace' => $row['namespace'],
'title' => $row['title'],
);
}
$smcFunc['db_free_result']($result);

if (!empty($page_data))
{
foreach ($page_data as $page)
{
if (isset($page_ids[$page['id']]))
foreach ($page_ids[$page['id']] as $k => $session_text)
$data[$k] = sprintf($session_text, $page['id'], censorText($page['title']));

if (isset($page_ids[$page['namespace']]))
foreach ($page_ids[$page['namespace']] as $k => $session_text)
$data[$k] = sprintf($session_text, $page['namespace'], censorText($page['title']));
}
}
}

// Load member names for the profile.

./Themes/default/Display.template.php

Find: [Select]
// Show the page index... "Pages: [1]".
Replace With: [Select]
// Make Article Button
if ($context['can_make_article'])
$normal_buttons['article'] = array('text' => 'sp-' . ($context['topic_is_article'] ? 'remove' : 'add') . '_article', 'image' => 'addarticle.gif', 'lang' => true, 'url' => $scripturl . '?action=portal;sa=' . ($context['topic_is_article'] ? 'remove' : 'add') . 'article;message=' . $context['topic_first_message'] . ';return=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']);

// Show the page index... "Pages: [1]".

Code

install2.php

This file should be able to execute standalone.

File Operations

Move the included file "PortalStandalone.php" to "the root directory".
Move the included directory "smf2/Sources" to "the root directory".
Move the included directory "smf2/Themes" to "the root directory".
Move the included directory "languages" to "./Themes/default".
Move the included directory "sp" to "./Themes/default/images".
Move the included directory "admin" to "./Themes/default/images".
Move the included file "portal.css" to "./Themes/default/css".
Move the included file "portal_rtl.css" to "./Themes/default/css".
Move the included file "portal.js" to "./Themes/default/scripts".