simpleportal installed

This commit is contained in:
Tom 2014-05-20 15:57:52 +00:00
parent 9143595060
commit 4df31ab18f
121 changed files with 15355 additions and 25 deletions

Binary file not shown.

View File

@ -1 +1 @@
1392908711
1400527916

76
PortalStandalone.php Normal file
View File

@ -0,0 +1,76 @@
<?php
/**********************************************************************************
* PortalStandalone.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
/*
This file here, unbelievably, has your portal within.
In order to use SimplePortal in standalone mode:
+ Go to "SPortal Admin" >> "Configuration" >> "General Settings"
+ Select "Standalone" mode as "Portal Mode"
+ Set "Standalone URL" as the full url of this file.
+ Edit path to the forum ($forum_dir) in this file.
See? It's just magic!
*/
global $sp_standalone;
// Should be the full path!
$forum_dir = '/home/www-data/htdocs/moparscape.org/smf';
// Let them know the mode.
$sp_standalone = true;
// Hmm, wrong forum dir?
if (!file_exists($forum_dir . '/index.php'))
die('Wrong $forum_dir value. Please make sure that the $forum_value variable points to your forum\'s directory.');
// Get out the forum's SMF version number.
$data = substr(file_get_contents($forum_dir . '/index.php'), 0, 4096);
if (preg_match('~\*\s*Software\s+Version:\s+(SMF\s+.+?)[\s]{2}~i', $data, $match))
$forum_version = $match[1];
elseif (preg_match('~\*\s@version\s+(.+)[\s]{2}~i', $data, $match))
$forum_version = 'SMF ' . $match[1];
// Call the SSI magic.
require_once($forum_dir . '/SSI.php');
// Wireless? We don't support you, yet.
if (WIRELESS)
redirectexit();
// Get our main file.
require_once($sourcedir . '/PortalMain.php');
// Re-initialize SP.
sportal_init(true);
// Get the page ready.
sportal_main();
// Here we go!
obExit(true);
?>

View File

@ -64,6 +64,7 @@ require_once($sourcedir . '/Subs.php');
require_once($sourcedir . '/Errors.php');
require_once($sourcedir . '/Load.php');
require_once($sourcedir . '/Security.php');
require_once($sourcedir . '/Subs-Portal.php');
// Using an pre-PHP 5.1 version?
if (@version_compare(PHP_VERSION, '5.1') == -1)
@ -144,6 +145,9 @@ loadPermissions();
// Load the current or SSI theme. (just use $ssi_theme = id_theme;)
loadTheme(isset($ssi_theme) ? (int) $ssi_theme : 0);
// Load some SP stuff.
sportal_init();
// Take care of any banning that needs to be done.
if (isset($_REQUEST['ssi_ban']) || (isset($ssi_ban) && $ssi_ban === true))
is_not_banned();

View File

@ -286,6 +286,77 @@ function AdminMain()
),
),
),
'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']),
'header' => array($txt['sp-positionHeader']),
'left' => array($txt['sp-positionLeft']),
'top' => array($txt['sp-positionTop']),
'bottom' => array($txt['sp-positionBottom']),
'right' => array($txt['sp-positionRight']),
'footer' => array($txt['sp-positionFooter']),
),
),
'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(
'title' => $txt['admin_manage_members'],
'permission' => array('moderate_forum', 'manage_membergroups', 'manage_bans', 'manage_permissions', 'admin_forum'),
@ -724,7 +795,7 @@ function AdminSearchInternal()
// All the files we need to include.
$include_files = array(
'ManageSettings', 'ManageBoards', 'ManageNews', 'ManageAttachments', 'ManageCalendar', 'ManageMail', 'ManagePaid', 'ManagePermissions',
'ManagePosts', 'ManageRegistration', 'ManageSearch', 'ManageSearchEngines', 'ManageServer', 'ManageSmileys',
'ManagePosts', 'ManageRegistration', 'ManageSearch', 'ManageSearchEngines', 'ManageServer', 'ManageSmileys', 'PortalAdminMain',
);
foreach ($include_files as $file)
require_once($sourcedir . '/' . $file . '.php');
@ -795,6 +866,13 @@ function AdminSearchInternal()
array('ModifyPruningSettings', 'area=logs;sa=pruning'),
);
// 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)
{
// Get a list of their variables.

View File

@ -43,7 +43,7 @@ function BoardIndex()
$context['canonical_url'] = $scripturl;
// Do not let search engines index anything if there is a random thing in $_GET.
if (!empty($_GET))
if (!empty($_GET) && $_GET !== array('action' => 'forum'))
$context['robot_no_index'] = true;
// Retrieve the categories and boards.

View File

@ -372,6 +372,18 @@ function Display()
censorText($topicinfo['subject']);
$context['page_title'] = $topicinfo['subject'];
// 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?
$topicinfo['is_sticky'] = empty($modSettings['enableStickyTopics']) ? '0' : $topicinfo['is_sticky'];

View File

@ -81,6 +81,8 @@ function ShowAdminHelp()
// Load the admin help language file and template.
loadLanguage('Help');
// Load the Simple Portal Help file.
loadLanguage('SPortalHelp', sp_languageSelect('SPortalHelp'));
// Permission specific help?
if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp')

View File

@ -1401,6 +1401,19 @@ function loadTheme($id_theme = 0, $initialize = true)
else
$id_theme = $modSettings['theme_guests'];
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.
// Always allow the board specific theme, if they are overriding.
if (!empty($board_info['theme']) && $board_info['override_theme'])
@ -1655,6 +1668,12 @@ function loadTheme($id_theme = 0, $initialize = true)
'spellcheck',
);
// 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.
if (WIRELESS)
{

View File

@ -1413,6 +1413,7 @@ function loadAllPermissions($loadType = 'classic')
'simple' => array(
'view_basic_info',
'use_pm_system',
'sp',
'post_calendar',
'edit_profile',
'delete_account',
@ -1423,6 +1424,7 @@ function loadAllPermissions($loadType = 'classic')
'classic' => array(
'general',
'pm',
'sp',
'calendar',
'maintenance',
'member_admin',
@ -1467,6 +1469,15 @@ function loadAllPermissions($loadType = 'classic')
'search_posts' => array(false, 'general', 'view_basic_info'),
'karma_edit' => array(false, 'general', 'moderate_general'),
'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'),
'sp_remove_article' => array(false, 'sp', 'sp'),
'pm_send' => array(false, 'pm', 'use_pm_system'),
'calendar_view' => array(false, 'calendar', 'view_basic_info'),
'calendar_post' => array(false, 'calendar', 'post_calendar'),

View File

@ -1824,6 +1824,7 @@ function prepareDBSettingContext(&$config_vars)
global $txt, $helptxt, $context, $modSettings, $sourcedir;
loadLanguage('Help');
loadLanguage('SPortalHelp', sp_languageSelect('SPortalHelp'));
$context['config_vars'] = array();
$inlinePermissions = array();

View File

@ -0,0 +1,812 @@
<?php
/**********************************************************************************
* PortalAdminArticles.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_admin_articles_main()
// !!!
void sportal_admin_article_list()
// !!!
array sportal_admin_articles_callback()
// !!!
void sportal_admin_article_add()
// !!!
void sportal_admin_article_edit()
// !!!
void sportal_admin_article_delete()
// !!!
void sportal_admin_category_list()
// !!!
void sportal_admin_category_add()
// !!!
void sportal_admin_category_edit()
// !!!
void sportal_admin_category_delete()
// !!!
*/
function sportal_admin_articles_main()
{
global $context, $txt, $scripturl, $sourcedir;
if (!allowedTo('sp_admin'))
isAllowedTo('sp_manage_articles');
require_once($sourcedir . '/Subs-PortalAdmin.php');
loadTemplate('PortalAdminArticles');
$subActions = array(
'articles' => 'sportal_admin_article_list',
'addarticle' => 'sportal_admin_article_add',
'editarticle' => 'sportal_admin_article_edit',
'deletearticle' => 'sportal_admin_article_delete',
'categories' => 'sportal_admin_category_list',
'addcategory' => 'sportal_admin_category_add',
'editcategory' => 'sportal_admin_category_edit',
'deletecategory' => 'sportal_admin_category_delete',
'statechange' => 'sportal_admin_state_change',
);
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'articles';
$context['sub_action'] = $_REQUEST['sa'];
$context[$context['admin_menu_name']]['tab_data'] = array(
'title' => $txt['sp-adminCatTitle'],
'help' => 'sp_ArticlesArea',
'description' => $txt['sp-adminCatDesc'],
'tabs' => array(
'articles' => array(
'description' => $txt['sp-adminArticleListDesc'],
),
'addarticle' => array(
'description' => $txt['sp-adminArticleAddDesc'],
),
'categories' => array(
'description' => $txt['sp-adminCategoryListDesc'],
),
'addcategory' => array(
'description' => $txt['sp-adminCategoryAddDesc'],
),
),
);
$subActions[$_REQUEST['sa']]();
}
// Function to 'Show' a list of Articles, and allow 'quick' deletion of them.
function sportal_admin_article_list()
{
global $txt, $smcFunc, $context, $article_request, $scripturl;
// Call the template.
$context['sub_template'] = 'article_list';
// You clicked the remove button? Naughty boy. :P
if (!empty($_POST['removeArticles']) && !empty($_POST['remove']) && is_array($_POST['remove']))
{
// Are you even allowed to be here?
checkSession();
// Sanitize the articles to remove non integers.
foreach ($_POST['remove'] as $index => $article_id)
$_POST['remove'][(int) $index] = (int) $article_id;
// Delete the required articles.
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_articles
WHERE id_article IN ({array_int:remove})',
array(
'remove' => $_POST['remove'],
)
);
// Fix the category article count.
fixCategoryArticles();
}
// How can we sort the list of articles?
$sort_methods = array(
'topic' => array(
'down' => 'm.subject ASC',
'up' => 'm.subject DESC'
),
'board' => array(
'down' => 'b.name ASC',
'up' => 'b.name DESC'
),
'poster' => array(
'down' => 'm.poster_name ASC',
'up' => 'm.poster_name DESC'
),
'time' => array(
'down' => 'm.poster_time ASC',
'up' => 'm.poster_time DESC'
),
'category' => array(
'down' => 'c.name ASC',
'up' => 'c.name DESC'
),
'approved' => array(
'down' => 'a.approved ASC',
'up' => 'a.approved DESC'
),
);
// Columns to show.
$context['columns'] = array(
'topic' => array(
'width' => '20%',
'label' => $txt['sp-adminColumnTopic'],
'class' => 'first_th',
'sortable' => true
),
'board' => array(
'width' => '20%',
'label' => $txt['sp-adminColumnBoard'],
'sortable' => true
),
'poster' => array(
'width' => '10%',
'label' => $txt['sp-adminColumnPoster'],
'sortable' => true
),
'time' => array(
'width' => '17%',
'label' => $txt['sp-adminColumnTime'],
'sortable' => true
),
'category' => array(
'width' => '20%',
'label' => $txt['sp-adminColumnCategory'],
'sortable' => true
),
'approved' => array(
'width' => '8%',
'label' => $txt['sp-adminColumnApproved'],
'sortable' => true,
),
'actions' => array(
'width' => '5%',
'label' => $txt['sp-adminColumnAction'],
'sortable' => false
)
);
// Default sort is according to the topic.
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
$_REQUEST['sort'] = 'topic';
// Setup the sort links.
foreach ($context['columns'] as $col => $dummy)
{
$context['columns'][$col]['selected'] = $col == $_REQUEST['sort'];
$context['columns'][$col]['href'] = $scripturl . '?action=admin;area=portalarticles;sa=articles;sort=' . $col;
if (!isset($_REQUEST['desc']) && $col == $_REQUEST['sort'])
$context['columns'][$col]['href'] .= ';desc';
$context['columns'][$col]['link'] = '<a href="' . $context['columns'][$col]['href'] . '">' . $context['columns'][$col]['label'] . '</a>';
}
$context['sort_by'] = $_REQUEST['sort'];
$context['sort_direction'] = !isset($_REQUEST['desc']) ? 'down' : 'up';
// Count all the articles.
$request = $smcFunc['db_query']('','
SELECT COUNT(*)
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
WHERE {query_see_board}'
);
list ($context['total_articles']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// Construct the page index. 20 articles per page.
$context['page_index'] = constructPageIndex($scripturl . '?action=admin;area=portalarticles;sa=articles;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $context['total_articles'], 20);
$context['start'] = $_REQUEST['start'];
// A *small* query to get article info.
$article_request = $smcFunc['db_query']('','
SELECT a.id_article, a.id_category, a.id_message, a.approved, c.name as cname, m.id_member, m.poster_name,
m.poster_time, m.subject, t.id_topic, t.num_replies, t.num_views, b.id_board, b.name as bname, mem.real_name
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}topics AS t ON (t.id_first_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
WHERE {query_see_board}
ORDER BY {raw:sort}
LIMIT {int:start}, {int:limit}',
array(
'sort' => $sort_methods[$_REQUEST['sort']][$context['sort_direction']],
'start' => $context['start'],
'limit' => 20,
)
);
// Call-back...
$context['get_article'] = 'sportal_admin_articles_callback';
$context['page_title'] = $txt['sp-adminArticleListName'];
}
// Call-back for getting a row of article data.
function sportal_admin_articles_callback($reset = false)
{
global $scripturl, $article_request, $txt, $context, $settings, $smcFunc;
if ($article_request == false)
return false;
if (!($row = $smcFunc['db_fetch_assoc']($article_request)))
return false;
// Build up the array.
$output = array(
'article' => array(
'id' => $row['id_article'],
'approved' => $row['approved'],
),
'category' => array(
'id' => $row['id_category'],
'name' => '<a href="' . $scripturl . '?action=admin;area=portalarticles;sa=editcategory;category_id=' . $row['id_category'] . '">'.$row['cname'].'</a>',
),
'message' => array(
'id' => $row['id_message'],
'subject' => $row['subject'],
'time' => timeformat($row['poster_time'], '%H:%M:%S, %d/%m/%y'),
),
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'link' => !empty($row['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>' : $row['poster_name'],
),
'topic' => array(
'id' => $row['id_topic'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>',
),
'board' => array(
'id' => $row['id_board'],
'name' => $row['bname'],
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>',
),
'edit' => '<a href="' . $scripturl . '?action=admin;area=portalarticles;sa=editarticle;article_id=' . $row['id_article'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . sp_embed_image('modify') . '</a>',
'delete' => '<a href="' . $scripturl . '?action=admin;area=portalarticles;sa=deletearticle;article_id=' . $row['id_article'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'' . $txt['sp-articlesDeleteConfirm'] . '\');">' . sp_embed_image('delete') . '</a>'
);
return $output;
}
// Function for adding articles.
function sportal_admin_article_add()
{
global $txt, $context, $scripturl, $smcFunc, $modSettings;
// Are we ready?
if(empty($_POST['createArticle']) || empty($_POST['articles']))
{
// List all the categories.
$context['list_categories'] = getCategoryInfo();
// Do we have any category to add?
if(empty($context['list_categories']))
fatal_error($txt['error_sp_no_category'] . '<br />' . sprintf($txt['error_sp_no_category_sp_moderator'], $scripturl . '?action=admin;area=portalarticles;sa=addcategory'), false);
// Which board to show?
if(isset($_REQUEST['targetboard']))
$_REQUEST['targetboard'] = (int) $_REQUEST['targetboard'];
else
{
// Find one yourself.
$request = $smcFunc['db_query']('','
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE b.redirect = \'\'
AND {query_see_board}
ORDER BY b.id_board DESC
LIMIT 1'
);
list ($_REQUEST['targetboard']) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
}
$context['target_board'] = $_REQUEST['targetboard'];
// Get the total topic count.
$request = $smcFunc['db_query']('','
SELECT COUNT(*)
FROM {db_prefix}topics as t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
LEFT JOIN {db_prefix}sp_articles as a ON (a.id_message = t.id_first_msg)
WHERE t.id_board = {int:targetboard}
AND IFNULL(a.id_article, 0) = 0
AND {query_see_board}',
array(
'targetboard' => $_REQUEST['targetboard'],
)
);
list ($topiccount) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
// Create the page index.
$context['page_index'] = constructPageIndex($scripturl . '?action=admin;area=portalarticles;sa=addarticle;targetboard=' . $_REQUEST['targetboard'] . ';board=' . $_REQUEST['targetboard'] . '.%d', $_REQUEST['start'], $topiccount, $modSettings['defaultMaxTopics'], true);
// Get some info about the boards and categories.
$request = $smcFunc['db_query']('','
SELECT b.id_board, b.name AS bName, c.name AS cName
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
WHERE b.redirect = \'\'
AND {query_see_board}'
);
$context['boards'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$context['boards'][] = array(
'id' => $row['id_board'],
'name' => $row['bName'],
'category' => $row['cName']
);
$smcFunc['db_free_result']($request);
// Time to get the topic data.
$request = $smcFunc['db_query']('','
SELECT t.id_topic, m.subject, m.id_member, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.id_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}sp_articles as a ON (a.id_message = t.id_first_msg)
WHERE IFNULL(a.id_article, 0) = {int:article}
AND t.id_board = {int:targetboard}
AND {query_see_board}
ORDER BY ' . (!empty($modSettings['enableStickyTopics']) ? 't.is_sticky DESC, ' : '') . 't.id_last_msg DESC
LIMIT {int:start}, {int:max}',
array(
'article' => 0,
'targetboard' => $_REQUEST['targetboard'],
'start' => $_REQUEST['start'],
'max' => $modSettings['defaultMaxTopics'],
)
);
$context['topics'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
censorText($row['subject']);
$context['topics'][] = array(
'id' => $row['id_topic'],
'msg_id' => $row['id_msg'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" target="_blank">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'js_subject' => addcslashes(addslashes($row['subject']), '/')
);
}
$smcFunc['db_free_result']($request);
// Set the page title and sub-template.
$context['page_title'] = $txt['sp-articlesAdd'];
$context['sub_template'] = 'article_add';
}
else
{
// But can you?
checkSession();
// Are they integer?
foreach ($_POST['articles'] as $index => $article_id)
$_POST['articles'][(int) $index] = (int) $article_id;
// Add all of them.
foreach($_POST['articles'] as $article) {
// Set them. They have their own IDs.
$articleOptions = array(
'id_category' => !empty($_POST['category']) ? (int) $_POST['category'] : 0,
'id_message' => $article,
'approved' => 1,
);
// A tricky function.
createArticle($articleOptions);
}
// Time to go back.
redirectexit('action=admin;area=portalarticles;sa=articles');
}
}
// Function for editing an article.
function sportal_admin_article_edit()
{
global $txt, $smcFunc, $context;
global $func;
// Seems that we aren't ready.
if(empty($_POST['add_article']))
{
// Check it as we just accept integer.
$_REQUEST['article_id'] = (int) $_REQUEST['article_id'];
// Do we know the one to be edited?
if(empty($_REQUEST['article_id']))
fatal_lang_error('error_sp_id_empty', false);
// Get the article info.
$context['article_info'] = getArticleInfo($_REQUEST['article_id']);
$context['article_info'] = $context['article_info'][0];
// List all the categories.
$context['list_categories'] = getCategoryInfo();
// Call the right template.
$context['page_title'] = $txt['sp-articlesEdit'];
$context['sub_template'] = 'article_edit';
}
else
{
// A small array.
$articleInfo = array(
'category' => $_POST['category'],
'approved' => empty($_POST['approved']) ? '0' : '1',
);
// Do it please.
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_articles
SET id_category = {int:category}, approved = {int:approved}
WHERE id_article = {int:id}',
array(
'id' => $_POST['article_id'],
'category' => $articleInfo['category'],
'approved' => $articleInfo['approved'],
)
);
// Fix the article counts.
fixCategoryArticles();
// I wanna go back to the list. :)
redirectexit('action=admin;area=portalarticles;sa=articles');
}
}
// Deleting an article...
function sportal_admin_article_delete()
{
global $smcFunc, $context;
// Check if he can?
checkSession('get');
// We just accept integers.
$_REQUEST['article_id'] = (int) $_REQUEST['article_id'];
// Can't delete without an ID.
if(empty($_REQUEST['article_id']))
fatal_lang_error('error_sp_id_empty', false);
// Life is short... Delete it.
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_articles
WHERE id_article = {int:id}',
array(
'id' => $_REQUEST['article_id'],
)
);
// Fix the article counts.
fixCategoryArticles();
// Again comes the list.
redirectexit('action=admin;area=portalarticles;sa=articles');
}
// Gets the category list.
function sportal_admin_category_list()
{
global $txt, $context;
// Category list columns.
$context['columns'] = array(
'picture' => array(
'width' => '35%',
'label' => $txt['sp-adminColumnPicture'],
'class' => 'first_th',
),
'name' => array(
'width' => '45%',
'label' => $txt['sp-adminColumnName'],
),
'articles' => array(
'width' => '5%',
'label' => $txt['sp-adminColumnArticles'],
),
'publish' => array(
'width' => '5%',
'label' => $txt['sp-adminColumnPublish'],
),
'action' => array(
'width' => '10%',
'label' => $txt['sp-adminColumnAction'],
'class' => 'last_th',
),
);
// Get all the categories.
$context['categories'] = getCategoryInfo();
// Call the sub template.
$context['sub_template'] = 'category_list';
$context['page_title'] = $txt['sp-adminCategoryListName'];
}
// Function for adding a category.
function sportal_admin_category_add()
{
global $txt, $smcFunc, $context, $func;
// Not actually adding a category? Show the add category page.
if(empty($_POST['edit_category']))
{
// Just we need the template.
$context['sub_template'] = 'category_edit';
$context['page_title'] = $txt['sp-categoriesAdd'];
$context['category_action'] = 'add';
}
// Adding a category? Lets do this thang! ;D
else
{
// Session check.
checkSession();
// Category name can't be empty.
if (empty($_POST['category_name']))
fatal_lang_error('error_sp_name_empty', false);
// A small info array.
$categoryInfo = array(
'name' => $smcFunc['htmlspecialchars']($_POST['category_name'], ENT_QUOTES),
'picture' => $smcFunc['htmlspecialchars']($_POST['picture_url'], ENT_QUOTES),
'publish' => empty($_POST['show_on_index']) ? '0' : '1',
);
// Insert the category data.
$smcFunc['db_insert']('normal', '{db_prefix}sp_categories',
// Columns to insert.
array(
'name' => 'string',
'picture' => 'string',
'articles' => 'int',
'publish' => 'int'
),
// Data to put in.
array(
'name' => $categoryInfo['name'],
'picture' => $categoryInfo['picture'],
'articles' => 0,
'publish' => $categoryInfo['publish']
),
// We had better tell SMF about the key, even though I can't remember why? ;)
array('id_category')
);
// Return back to the category list.
redirectexit('action=admin;area=portalarticles;sa=categories');
}
}
// Handles the category edit issue.
function sportal_admin_category_edit()
{
global $txt, $smcFunc, $context, $func;
// Not Time to edit? Show the cagegory edit page.
if(empty($_POST['edit_category']))
{
// Be sure you made it an integer.
$_REQUEST['category_id'] = (int) $_REQUEST['category_id'];
// Show you ID.
if(empty($_REQUEST['category_id']))
fatal_lang_error('error_sp_id_empty', false);
// Get the category info. You need in template.
$context['category_info'] = getCategoryInfo($_REQUEST['category_id']);
$context['category_info'] = $context['category_info'][0];
// Call the right sub template.
$context['sub_template'] = 'category_edit';
$context['page_title'] = $txt['sp-categoriesEdit'];
$context['category_action'] = 'edit';
}
// Perform the actual edits.
else
{
// Again.
checkSession();
// Why empty? :S
if (empty($_POST['category_name']))
fatal_lang_error('error_sp_name_empty', false);
// Array for the db.
$categoryInfo = array(
'name' => $smcFunc['htmlspecialchars']($_POST['category_name'], ENT_QUOTES),
'picture' => $smcFunc['htmlspecialchars']($_POST['picture_url'], ENT_QUOTES),
'publish' => empty($_POST['show_on_index']) ? '0' : '1',
);
// What to change?
$category_fields = array();
$category_fields[] = "name = {string:name}";
$category_fields[] = "picture = {string:picture}";
$category_fields[] = "publish = {int:publish}";
// Go on.
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_categories
SET ' . implode(', ', $category_fields) . '
WHERE id_category = {int:id}',
array(
'id' => $_POST['category_id'],
'name' => $categoryInfo['name'],
'picture' => $categoryInfo['picture'],
'publish' => $categoryInfo['publish'],
)
);
// Take him back to the list.
redirectexit('action=admin;area=portalarticles;sa=categories');
}
}
// Does more than deleting...
function sportal_admin_category_delete()
{
global $smcFunc, $context, $txt;
// Is an id set? If yes, then we need to get some category information.
if(!empty($_REQUEST['category_id']))
{
// Be sure you made it an integer.
$_REQUEST['category_id'] = (int) $_REQUEST['category_id'];
// Do you know which one to delete?
if(empty($_REQUEST['category_id']))
fatal_lang_error('error_sp_id_empty', false);
// Get the category info. You need in template.
$context['category_info'] = getCategoryInfo($_REQUEST['category_id']);
$context['category_info'] = $context['category_info'][0];
// Also get the category list.
$context['list_categories'] = getCategoryInfo();
// If we have one, that is itself. Delete it.
if(count($context['list_categories']) < 2)
$context['list_categories'] = array();
}
if(empty($_REQUEST['category_id']) && empty($_POST['category_id']))
fatal_lang_error('error_sp_id_empty', false);
// No need to delete articles if category has no articles. But articles are executed if there isn't any other category. :P
if(empty($_POST['delete_category']) && !empty($context['category_info']['articles']))
{
// Call the right sub template.
$context['sub_template'] = 'category_delete';
$context['page_title'] = $txt['sp-categoriesDelete'];
}
elseif(!empty($_POST['delete_category']))
{
// Again.
checkSession();
// Are we going to move something?
if(!empty($_POST['category_move']) && !empty($_POST['category_move_to'])) {
// We just need an integer.
$_POST['category_move_to'] = (int) $_POST['category_move_to'];
// These are the lucky ones, move them.
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_articles
SET id_category = {int:category_move_to}
WHERE id_category = {int:category_id}',
array(
'category_move_to' => $_POST['category_move_to'],
'category_id' => $_POST['category_id'],
)
);
// Fix the article counts.
fixCategoryArticles();
}
else
{
// Kill 'em all. (It's not the Metallica album. :P)
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_articles
WHERE id_category = {int:category_id}',
array(
'category_id' => $_POST['category_id'],
)
);
}
// Everybody will die one day...
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_categories
WHERE id_category = {int:category_id}',
array(
'category_id' => $_POST['category_id'],
)
);
// Return to the list.
redirectexit('action=admin;area=portalarticles;sa=categories');
}
else
{
// Again.
checkSession('get');
// Just delete the category.
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_categories
WHERE id_category = {int:category_id}',
array(
'category_id' => $_REQUEST['category_id'],
)
);
// Fix the article counts.
fixCategoryArticles();
// Return to the list.
redirectexit('action=admin;area=portalarticles;sa=categories');
}
}
?>

File diff suppressed because it is too large Load Diff

348
Sources/PortalAdminMain.php Normal file
View File

@ -0,0 +1,348 @@
<?php
/**********************************************************************************
* PortalAdminMain.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_admin_config_main()
// !!!
void sportal_admin_general_settings()
// !!!
void sportal_admin_block_settings()
// !!!
void sportal_admin_article_settings()
// !!!
void sportal_information()
// !!!
*/
function sportal_admin_config_main()
{
global $sourcedir, $context, $txt;
if (!allowedTo('sp_admin'))
isAllowedTo('sp_manage_settings');
require_once($sourcedir . '/Subs-PortalAdmin.php');
require_once($sourcedir . '/ManageServer.php');
loadTemplate('PortalAdmin');
$subActions = array(
'information' => 'sportal_information',
'generalsettings' => 'sportal_admin_general_settings',
'blocksettings' => 'sportal_admin_block_settings',
'articlesettings' => 'sportal_admin_article_settings',
);
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'information';
$context[$context['admin_menu_name']]['tab_data'] = array(
'title' => $txt['sp-adminConfiguration'],
'help' => 'sp_ConfigurationArea',
'description' => $txt['sp-adminConfigurationDesc'],
);
$subActions[$_REQUEST['sa']]();
}
function sportal_admin_general_settings($return_config = '')
{
global $smcFunc, $context, $scripturl, $txt;
$request = $smcFunc['db_query']('','
SELECT id_theme, value AS name
FROM {db_prefix}themes
WHERE variable = {string:name}
AND id_member = {int:member}
ORDER BY id_theme',
array(
'member' => 0,
'name' => 'name',
)
);
$context['SPortal']['themes'] = array('0' => &$txt['portalthemedefault']);
while ($row = $smcFunc['db_fetch_assoc']($request))
$context['SPortal']['themes'][$row['id_theme']] = $row['name'];
$smcFunc['db_free_result']($request);
$config_vars = array(
array('select', 'sp_portal_mode', explode('|', $txt['sp_portal_mode_options'])),
array('check', 'sp_maintenance'),
array('text', 'sp_standalone_url'),
'',
array('select', 'portaltheme', $context['SPortal']['themes']),
array('check', 'sp_disableColor'),
array('check', 'sp_disableForumRedirect'),
array('check', 'sp_disable_random_bullets'),
array('check', 'sp_disable_php_validation'),
array('check', 'sp_disable_side_collapse'),
array('check', 'sp_resize_images'),
);
if ($return_config)
return $config_vars;
if (isset($_GET['save']))
{
checkSession();
saveDBSettings($config_vars);
redirectexit('action=admin;area=portalconfig;sa=generalsettings');
}
$context['post_url'] = $scripturl . '?action=admin;area=portalconfig;sa=generalsettings;save';
$context['settings_title'] = $txt['sp-adminGeneralSettingsName'];
$context['page_title'] = $txt['sp-adminGeneralSettingsName'];
$context['sub_template'] = 'general_settings';
prepareDBSettingContext($config_vars);
}
function sportal_admin_block_settings($return_config = '')
{
global $context, $scripturl, $txt;
$config_vars = array(
array('check', 'showleft'),
array('check', 'showright'),
array('text', 'leftwidth'),
array('text', 'rightwidth'),
'',
array('check', 'sp_enableIntegration'),
array('multicheck', 'sp_IntegrationHide', 'subsettings' => array('sp_adminIntegrationHide' => $txt['admin'], 'sp_profileIntegrationHide' => $txt['profile'], 'sp_pmIntegrationHide' => $txt['personal_messages'], 'sp_mlistIntegrationHide' => $txt['members_title'], 'sp_searchIntegrationHide' => $txt['search'], 'sp_calendarIntegrationHide' => $txt['calendar'], 'sp_moderateIntegrationHide' => $txt['moderate'])),
);
if ($return_config)
return $config_vars;
if (isset($_GET['save']))
{
checkSession();
$width_checkup = array('left', 'right');
foreach ($width_checkup as $pos)
{
if (!empty($_POST[$pos . 'width']))
{
if (stripos($_POST[$pos . 'width'], 'px') !== false)
$suffix = 'px';
elseif (strpos($_POST[$pos . 'width'], '%') !== false)
$suffix = '%';
else
$suffix = '';
preg_match_all('/(?:([0-9]+)|.)/i', $_POST[$pos . 'width'], $matches);
$number = (int) implode('', $matches[1]);
if (!empty($number) && $number > 0)
$_POST[$pos . 'width'] = $number . $suffix;
else
$_POST[$pos . 'width'] = '';
}
else
$_POST[$pos . 'width'] = '';
}
unset($config_vars[7]);
$config_vars = array_merge(
$config_vars,
array(
array('check', 'sp_adminIntegrationHide'),
array('check', 'sp_profileIntegrationHide'),
array('check', 'sp_pmIntegrationHide'),
array('check', 'sp_mlistIntegrationHide'),
array('check', 'sp_searchIntegrationHide'),
array('check', 'sp_calendarIntegrationHide'),
array('check', 'sp_moderateIntegrationHide'),
)
);
saveDBSettings($config_vars);
redirectexit('action=admin;area=portalconfig;sa=blocksettings');
}
$context['post_url'] = $scripturl . '?action=admin;area=portalconfig;sa=blocksettings;save';
$context['settings_title'] = $txt['sp-adminBlockSettingsName'];
$context['page_title'] = $txt['sp-adminBlockSettingsName'];
$context['sub_template'] = 'general_settings';
prepareDBSettingContext($config_vars);
}
function sportal_admin_article_settings($return_config = '')
{
global $context, $scripturl, $txt;
$config_vars = array(
array('check', 'articleactive'),
array('int', 'articleperpage'),
array('int', 'articlelength'),
array('check', 'articleavatar'),
);
if ($return_config)
return $config_vars;
if (isset($_GET['save']))
{
checkSession();
saveDBSettings($config_vars);
redirectexit('action=admin;area=portalconfig;sa=articlesettings');
}
$context['post_url'] = $scripturl . '?action=admin;area=portalconfig;sa=articlesettings;save';
$context['settings_title'] = $txt['sp-adminArticleSettingsName'];
$context['page_title'] = $txt['sp-adminArticleSettingsName'];
$context['sub_template'] = 'general_settings';
prepareDBSettingContext($config_vars);
}
function sportal_information($in_admin = true)
{
global $context, $scripturl, $txt, $sourcedir, $sportal_version, $user_profile;
$context['sp_credits'] = array(
array(
'pretext' => $txt['sp-info_intro'],
'title' => $txt['sp-info_team'],
'groups' => array(
array(
'title' => $txt['sp-info_groups_pm'],
'members' => array(
'Eliana Tamerin',
'Huw',
),
),
array(
'title' => $txt['sp-info_groups_dev'],
'members' => array(
'<span onclick="if (getInnerHTML(this).indexOf(\'Sinan\') == -1) setInnerHTML(this, \'Sinan &quot;[SiNaN]&quot; &Ccedil;evik\'); return false;">Selman &quot;[SiNaN]&quot; Eser</span>',
'&#12487;&#12451;&#12531;1031',
'Nathaniel Baxter',
),
),
array(
'title' => $txt['sp-info_groups_support'],
'members' => array(
'<span onclick="if (getInnerHTML(this).indexOf(\'Queen\') == -1) setInnerHTML(this, \'Angelina &quot;Queen of Support&quot; Belle\'); return false;">AngelinaBelle</span>',
),
),
array(
'title' => $txt['sp-info_groups_customize'],
'members' => array(
'Robbo',
'Berat &quot;grafitus&quot; Do&#287;an',
'Blue',
),
),
array(
'title' => $txt['sp-info_groups_language'],
'members' => array(
'Jade &quot;Alundra&quot; Elizabeth',
'<span onclick="if (getInnerHTML(this).indexOf(\'King\') == -1) setInnerHTML(this, \'130 &quot;King of Pirates&quot; 860\'); return false;">130860</span>',
),
),
array(
'title' => $txt['sp-info_groups_marketing'],
'members' => array(
'Runic',
),
),
array(
'title' => $txt['sp-info_groups_beta'],
'members' => array(
'&#214;zg&#252;r',
'Willerby',
'David',
'Dr. Deejay',
'Brack1',
'c23_Mike',
'Underdog',
),
),
),
),
array(
'title' => $txt['sp-info_special'],
'posttext' => $txt['sp-info_anyone'],
'groups' => array(
array(
'title' => $txt['sp-info_groups_translators'],
'members' => array(
$txt['sp-info_translators_message'],
),
),
array(
'title' => $txt['sp-info_groups_founder'],
'members' => array(
),
),
array(
'title' => $txt['sp-info_groups_orignal_pm'],
'members' => array(
),
),
array(
'title' => $txt['sp-info_fam_fam'],
'members' => array(
$txt['sp-info_fam_fam_message'],
),
),
),
),
);
if (!$in_admin)
{
loadTemplate('PortalAdmin');
$context['robot_no_index'] = true;
$context['in_admin'] = false;
}
else
{
$context['in_admin'] = true;
$context['sp_version'] = $sportal_version;
$context['sp_managers'] = array();
require_once($sourcedir . '/Subs-Members.php');
$manager_ids = loadMemberData(membersAllowedTo('sp_admin'), false, 'minimal');
if ($manager_ids)
foreach ($manager_ids as $member)
$context['sp_managers'][] = '<a href="' . $scripturl . '?action=profile;u=' . $user_profile[$member]['id_member'] . '">' . $user_profile[$member]['real_name'] . '</a>';
}
$context['sub_template'] = 'information';
$context['page_title'] = $txt['sp-info_title'];
}
?>

View File

@ -0,0 +1,635 @@
<?php
/**********************************************************************************
* PortalAdminPages.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_admin_pages_main()
// !!!
void sportal_admin_page_list()
// !!!
void sportal_admin_page_edit()
// !!!
void sportal_admin_page_delete()
// !!!
void sportal_admin_page_status()
// !!!
*/
function sportal_admin_pages_main()
{
global $context, $txt, $scripturl, $sourcedir;
if (!allowedTo('sp_admin'))
isAllowedTo('sp_manage_pages');
require_once($sourcedir . '/Subs-PortalAdmin.php');
loadTemplate('PortalAdminPages');
$subActions = array(
'list' => 'sportal_admin_page_list',
'add' => 'sportal_admin_page_edit',
'edit' => 'sportal_admin_page_edit',
'delete' => 'sportal_admin_page_delete',
'status' => 'sportal_admin_page_status',
);
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list';
$context['sub_action'] = $_REQUEST['sa'];
$context[$context['admin_menu_name']]['tab_data'] = array(
'title' => $txt['sp_admin_pages_title'],
'help' => 'sp_PagesArea',
'description' => $txt['sp_admin_pages_desc'],
'tabs' => array(
'list' => array(
),
'add' => array(
),
),
);
$subActions[$_REQUEST['sa']]();
}
function sportal_admin_page_list()
{
global $txt, $smcFunc, $context, $scripturl;
if (!empty($_POST['remove_pages']) && !empty($_POST['remove']) && is_array($_POST['remove']))
{
checkSession();
foreach ($_POST['remove'] as $index => $page_id)
$_POST['remove'][(int) $index] = (int) $page_id;
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_pages
WHERE id_page IN ({array_int:pages})',
array(
'pages' => $_POST['remove'],
)
);
}
$sort_methods = array(
'title' => array(
'down' => 'title ASC',
'up' => 'title DESC'
),
'namespace' => array(
'down' => 'namespace ASC',
'up' => 'namespace DESC'
),
'type' => array(
'down' => 'type ASC',
'up' => 'type DESC'
),
'views' => array(
'down' => 'views ASC',
'up' => 'views DESC'
),
'status' => array(
'down' => 'status ASC',
'up' => 'status DESC'
),
);
$context['columns'] = array(
'title' => array(
'width' => '45%',
'label' => $txt['sp_admin_pages_col_title'],
'class' => 'first_th',
'sortable' => true
),
'namespace' => array(
'width' => '25%',
'label' => $txt['sp_admin_pages_col_namespace'],
'sortable' => true
),
'type' => array(
'width' => '8%',
'label' => $txt['sp_admin_pages_col_type'],
'sortable' => true
),
'views' => array(
'width' => '6%',
'label' => $txt['sp_admin_pages_col_views'],
'sortable' => true
),
'status' => array(
'width' => '6%',
'label' => $txt['sp_admin_pages_col_status'],
'sortable' => true
),
'actions' => array(
'width' => '10%',
'label' => $txt['sp_admin_pages_col_actions'],
'sortable' => false
),
);
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
$_REQUEST['sort'] = 'title';
foreach ($context['columns'] as $col => $dummy)
{
$context['columns'][$col]['selected'] = $col == $_REQUEST['sort'];
$context['columns'][$col]['href'] = $scripturl . '?action=admin;area=portalpages;sa=list;sort=' . $col;
if (!isset($_REQUEST['desc']) && $col == $_REQUEST['sort'])
$context['columns'][$col]['href'] .= ';desc';
$context['columns'][$col]['link'] = '<a href="' . $context['columns'][$col]['href'] . '">' . $context['columns'][$col]['label'] . '</a>';
}
$context['sort_by'] = $_REQUEST['sort'];
$context['sort_direction'] = !isset($_REQUEST['desc']) ? 'down' : 'up';
$request = $smcFunc['db_query']('','
SELECT COUNT(*)
FROM {db_prefix}sp_pages'
);
list ($total_pages) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['page_index'] = constructPageIndex($scripturl . '?action=admin;area=portalpages;sa=list;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $total_pages, 20);
$context['start'] = $_REQUEST['start'];
$request = $smcFunc['db_query']('','
SELECT id_page, namespace, title, type, views, status
FROM {db_prefix}sp_pages
ORDER BY {raw:sort}
LIMIT {int:start}, {int:limit}',
array(
'sort' => $sort_methods[$_REQUEST['sort']][$context['sort_direction']],
'start' => $context['start'],
'limit' => 20,
)
);
$context['pages'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$context['pages'][$row['id_page']] = array(
'id' => $row['id_page'],
'page_id' => $row['namespace'],
'title' => $row['title'],
'href' => $scripturl . '?page=' . $row['namespace'],
'link' => '<a href="' . $scripturl . '?page=' . $row['namespace'] . '">' . $row['title'] . '</a>',
'type' => $row['type'],
'type_text' => $txt['sp_pages_type_'. $row['type']],
'views' => $row['views'],
'status' => $row['status'],
'status_image' => '<a href="' . $scripturl . '?action=admin;area=portalpages;sa=status;page_id=' . $row['id_page'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . sp_embed_image(empty($row['status']) ? 'deactive' : 'active', $txt['sp_admin_pages_' . (!empty($row['status']) ? 'de' : '') . 'activate']) . '</a>',
'actions' => array(
'edit' => '<a href="' . $scripturl . '?action=admin;area=portalpages;sa=edit;page_id=' . $row['id_page'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . sp_embed_image('modify') . '</a>',
'delete' => '<a href="' . $scripturl . '?action=admin;area=portalpages;sa=delete;page_id=' . $row['id_page'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'', $txt['sp_admin_pages_delete_confirm'], '\');">' . sp_embed_image('delete') . '</a>',
)
);
}
$smcFunc['db_free_result']($request);
$context['sub_template'] = 'pages_list';
$context['page_title'] = $txt['sp_admin_pages_list'];
}
function sportal_admin_page_edit()
{
global $txt, $context, $modSettings, $smcFunc, $sourcedir, $options;
require_once($sourcedir . '/Subs-Editor.php');
require_once($sourcedir . '/Subs-Post.php');
$context['SPortal']['is_new'] = empty($_REQUEST['page_id']);
if (!empty($_REQUEST['content_mode']) && $_POST['type'] == 'bbc')
{
$_REQUEST['content'] = html_to_bbc($_REQUEST['content']);
$_REQUEST['content'] = un_htmlspecialchars($_REQUEST['content']);
$_POST['content'] = $_REQUEST['content'];
}
$context['sides'] = array(
5 => $txt['sp-positionHeader'],
1 => $txt['sp-positionLeft'],
2 => $txt['sp-positionTop'],
3 => $txt['sp-positionBottom'],
4 => $txt['sp-positionRight'],
6 => $txt['sp-positionFooter'],
);
$blocks = getBlockInfo();
$context['page_blocks'] = array();
foreach ($blocks as $block)
{
$shown = false;
$tests = array('all', 'allpages', 'sforum');
if (!$context['SPortal']['is_new'])
$tests[] = 'p' . ((int) $_REQUEST['page_id']);
foreach (array('display', 'display_custom') as $field)
{
if (substr($block[$field], 0, 4) === '$php')
continue 2;
$block[$field] = explode(',', $block[$field]);
if (!$context['SPortal']['is_new'] && in_array('-p' . ((int) $_REQUEST['page_id']), $block[$field]))
continue;
foreach ($tests as $test)
{
if (in_array($test, $block[$field]))
{
$shown = true;
break;
}
}
}
$context['page_blocks'][$block['column']][] = array(
'id' => $block['id'],
'label' => $block['label'],
'shown' => $shown,
);
}
if (!empty($_POST['submit']))
{
checkSession();
if (!isset($_POST['title']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['title'], ENT_QUOTES)) === '')
fatal_lang_error('sp_error_page_name_empty', false);
if (!isset($_POST['namespace']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['namespace'], ENT_QUOTES)) === '')
fatal_lang_error('sp_error_page_namespace_empty', false);
$result = $smcFunc['db_query']('','
SELECT id_page
FROM {db_prefix}sp_pages
WHERE namespace = {string:namespace}
AND id_page != {int:current}
LIMIT 1',
array(
'limit' => 1,
'namespace' => $smcFunc['htmlspecialchars']($_POST['namespace'], ENT_QUOTES),
'current' => (int) $_POST['page_id'],
)
);
list ($has_duplicate) = $smcFunc['db_fetch_row']($result);
$smcFunc['db_free_result']($result);
if (!empty($has_duplicate))
fatal_lang_error('sp_error_page_namespace_duplicate', false);
if (preg_match('~[^A-Za-z0-9_]+~', $_POST['namespace']) != 0)
fatal_lang_error('sp_error_page_namespace_invalid_chars', false);
if (preg_replace('~[0-9]+~', '', $_POST['namespace']) === '')
fatal_lang_error('sp_error_page_namespace_numeric', false);
if ($_POST['type'] == 'php' && !empty($_POST['content']) && empty($modSettings['sp_disable_php_validation']))
{
$error = sp_validate_php($_POST['content']);
if ($error)
fatal_lang_error('error_sp_php_' . $error, false);
}
$permission_set = 0;
$groups_allowed = $groups_denied = '';
if (!empty($_POST['permission_set']))
$permission_set = (int) $_POST['permission_set'];
elseif (!empty($_POST['membergroups']) && is_array($_POST['membergroups']))
{
$groups_allowed = $groups_denied = array();
foreach ($_POST['membergroups'] as $id => $value)
{
if ($value == 1)
$groups_allowed[] = (int) $id;
elseif ($value == -1)
$groups_denied[] = (int) $id;
}
$groups_allowed = implode(',', $groups_allowed);
$groups_denied = implode(',', $groups_denied);
}
if (!empty($_POST['blocks']) && is_array($_POST['blocks']))
{
foreach ($_POST['blocks'] as $id => $block)
$_POST['blocks'][$id] = (int) $block;
}
else
$_POST['blocks'] = array();
$fields = array(
'namespace' => 'string',
'title' => 'string',
'body' => 'string',
'type' => 'string',
'permission_set' => 'int',
'groups_allowed' => 'string',
'groups_denied' => 'string',
'style' => 'string',
'status' => 'int',
);
$page_info = array(
'id' => (int) $_POST['page_id'],
'namespace' => $smcFunc['htmlspecialchars']($_POST['namespace'], ENT_QUOTES),
'title' => $smcFunc['htmlspecialchars']($_POST['title'], ENT_QUOTES),
'body' => $smcFunc['htmlspecialchars']($_POST['content'], ENT_QUOTES),
'type' => $_POST['type'],
'permission_set' => $permission_set,
'groups_allowed' => $groups_allowed,
'groups_denied' => $groups_denied,
'style' => sportal_parse_style('implode'),
'status' => !empty($_POST['status']) ? 1 : 0,
);
if ($page_info['type'] == 'bbc')
preparsecode($page_info['body']);
if ($context['SPortal']['is_new'])
{
unset($page_info['id']);
$smcFunc['db_insert']('',
'{db_prefix}sp_pages',
$fields,
$page_info,
array('id_page')
);
$page_info['id'] = $smcFunc['db_insert_id']('{db_prefix}sp_pages', 'id_page');
}
else
{
$update_fields = array();
foreach ($fields as $name => $type)
$update_fields[] = $name . ' = {' . $type . ':' . $name . '}';
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_pages
SET ' . implode(', ', $update_fields) . '
WHERE id_page = {int:id}',
$page_info
);
}
$to_show = array();
$not_to_show = array();
$changes = array();
foreach ($context['page_blocks'] as $page_blocks)
{
foreach ($page_blocks as $block)
{
if ($block['shown'] && !in_array($block['id'], $_POST['blocks']))
$not_to_show[] = $block['id'];
elseif (!$block['shown'] && in_array($block['id'], $_POST['blocks']))
$to_show[] = $block['id'];
}
}
foreach ($to_show as $id)
{
if ((empty($blocks[$id]['display']) && empty($blocks[$id]['display_custom'])) || $blocks[$id]['display'] == 'sportal')
{
$changes[$id] = array(
'display' => 'portal,p' . $page_info['id'],
'display_custom' => '',
);
}
elseif (in_array($blocks[$id]['display'], array('allaction', 'allboard')))
{
$changes[$id] = array(
'display' => '',
'display_custom' => $blocks[$id]['display'] . ',p' . $page_info['id'],
);
}
elseif (in_array('-p' . $page_info['id'], explode(',', $blocks[$id]['display_custom'])))
{
$changes[$id] = array(
'display' => $blocks[$id]['display'],
'display_custom' => implode(',', array_diff(explode(',', $blocks[$id]['display_custom']), array('-p' . $page_info['id']))),
);
}
elseif (empty($blocks[$id]['display_custom']))
{
$changes[$id] = array(
'display' => implode(',', array_merge(explode(',', $blocks[$id]['display']), array('p' . $page_info['id']))),
'display_custom' => '',
);
}
else
{
$changes[$id] = array(
'display' => $blocks[$id]['display'],
'display_custom' => implode(',', array_merge(explode(',', $blocks[$id]['display_custom']), array('p' . $page_info['id']))),
);
}
}
foreach ($not_to_show as $id)
{
if (count(array_intersect(array($blocks[$id]['display'], $blocks[$id]['display_custom']), array('sforum', 'allpages', 'all'))) > 0)
{
$changes[$id] = array(
'display' => '',
'display_custom' => $blocks[$id]['display'] . $blocks[$id]['display_custom'] . ',-p' . $page_info['id'],
);
}
elseif (empty($blocks[$id]['display_custom']))
{
$changes[$id] = array(
'display' => implode(',', array_diff(explode(',', $blocks[$id]['display']), array('p' . $page_info['id']))),
'display_custom' => '',
);
}
else
{
$changes[$id] = array(
'display' => implode(',', array_diff(explode(',', $blocks[$id]['display']), array('p' . $page_info['id']))),
'display_custom' => implode(',', array_diff(explode(',', $blocks[$id]['display_custom']), array('p' . $page_info['id']))),
);
}
}
foreach ($changes as $id => $data)
{
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_blocks
SET
display = {string:display},
display_custom = {string:display_custom}
WHERE id_block = {int:id}',
array(
'id' => $id,
'display' => $data['display'],
'display_custom' => $data['display_custom'],
)
);
}
redirectexit('action=admin;area=portalpages');
}
if (!empty($_POST['preview']))
{
$permission_set = 0;
$groups_allowed = $groups_denied = array();
if (!empty($_POST['permission_set']))
$permission_set = (int) $_POST['permission_set'];
elseif (!empty($_POST['membergroups']) && is_array($_POST['membergroups']))
{
foreach ($_POST['membergroups'] as $id => $value)
{
if ($value == 1)
$groups_allowed[] = (int) $id;
elseif ($value == -1)
$groups_denied[] = (int) $id;
}
}
$context['SPortal']['page'] = array(
'id' => $_POST['page_id'],
'page_id' => $_POST['namespace'],
'title' => $smcFunc['htmlspecialchars']($_POST['title'], ENT_QUOTES),
'body' => $smcFunc['htmlspecialchars']($_POST['content'], ENT_QUOTES),
'type' => $_POST['type'],
'permission_set' => $permission_set,
'groups_allowed' => $groups_allowed,
'groups_denied' => $groups_denied,
'style' => sportal_parse_style('implode'),
'status' => !empty($_POST['status']),
);
if ($context['SPortal']['page']['type'] == 'bbc')
preparsecode($context['SPortal']['page']['body']);
loadTemplate('PortalPages');
$context['SPortal']['preview'] = true;
}
elseif ($context['SPortal']['is_new'])
{
$context['SPortal']['page'] = array(
'id' => 0,
'page_id' => 'page' . mt_rand(1, 5000),
'title' => $txt['sp_pages_default_title'],
'body' => '',
'type' => 'bbc',
'permission_set' => 3,
'groups_allowed' => array(),
'groups_denied' => array(),
'style' => '',
'status' => 1,
);
}
else
{
$_REQUEST['page_id'] = (int) $_REQUEST['page_id'];
$context['SPortal']['page'] = sportal_get_pages($_REQUEST['page_id']);
}
if ($context['SPortal']['page']['type'] == 'bbc')
$context['SPortal']['page']['body'] = str_replace(array('"', '<', '>', '&nbsp;'), array('&quot;', '&lt;', '&gt;', ' '), un_preparsecode($context['SPortal']['page']['body']));
if ($context['SPortal']['page']['type'] != 'bbc')
{
$temp_editor = !empty($options['wysiwyg_default']);
$options['wysiwyg_default'] = false;
}
$editorOptions = array(
'id' => 'content',
'value' => $context['SPortal']['page']['body'],
'width' => '95%',
'height' => '200px',
'preview_type' => 0,
);
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];
if (isset($temp_editor))
$options['wysiwyg_default'] = $temp_editor;
$context['SPortal']['page']['groups'] = sp_load_membergroups();
$context['SPortal']['page']['style'] = sportal_parse_style('explode', $context['SPortal']['page']['style'], !empty($context['SPortal']['preview']));
$context['page_title'] = $context['SPortal']['is_new'] ? $txt['sp_admin_pages_add'] : $txt['sp_admin_pages_edit'];
$context['sub_template'] = 'pages_edit';
}
function sportal_admin_page_delete()
{
global $smcFunc;
checkSession('get');
$page_id = !empty($_REQUEST['page_id']) ? (int) $_REQUEST['page_id'] : 0;
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_pages
WHERE id_page = {int:id}',
array(
'id' => $page_id,
)
);
redirectexit('action=admin;area=portalpages');
}
function sportal_admin_page_status()
{
global $smcFunc;
checkSession('get');
$page_id = !empty($_REQUEST['page_id']) ? (int) $_REQUEST['page_id'] : 0;
$smcFunc['db_query']('', '
UPDATE {db_prefix}sp_pages
SET status = CASE WHEN status = {int:is_active} THEN 0 ELSE 1 END
WHERE id_page = {int:id}',
array(
'is_active' => 1,
'id' => $page_id,
)
);
redirectexit('action=admin;area=portalpages');
}
?>

View File

@ -0,0 +1,589 @@
<?php
/**********************************************************************************
* PortalAdminShoutbox.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_admin_shoutbox_main()
// !!!
void sportal_admin_shoutbox_list()
// !!!
void sportal_admin_shoutbox_edit()
// !!!
void sportal_admin_shoutbox_delete()
// !!!
void sportal_admin_shoutbox_status()
// !!!
*/
function sportal_admin_shoutbox_main()
{
global $context, $txt, $scripturl, $sourcedir;
if (!allowedTo('sp_admin'))
isAllowedTo('sp_manage_shoutbox');
require_once($sourcedir . '/Subs-PortalAdmin.php');
loadTemplate('PortalAdminShoutbox');
$subActions = array(
'list' => 'sportal_admin_shoutbox_list',
'add' => 'sportal_admin_shoutbox_edit',
'edit' => 'sportal_admin_shoutbox_edit',
'prune' => 'sportal_admin_shoutbox_prune',
'delete' => 'sportal_admin_shoutbox_delete',
'status' => 'sportal_admin_shoutbox_status',
'blockredirect' => 'sportal_admin_shoutbox_block_redirect',
);
$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'list';
$context['sub_action'] = $_REQUEST['sa'];
$context[$context['admin_menu_name']]['tab_data'] = array(
'title' => $txt['sp_admin_shoutbox_title'],
'help' => 'sp_ShoutboxArea',
'description' => $txt['sp_admin_shoutbox_desc'],
'tabs' => array(
'list' => array(
),
'add' => array(
),
),
);
$subActions[$_REQUEST['sa']]();
}
function sportal_admin_shoutbox_list()
{
global $txt, $smcFunc, $context, $scripturl;
if (!empty($_POST['remove_shoutbox']) && !empty($_POST['remove']) && is_array($_POST['remove']))
{
checkSession();
foreach ($_POST['remove'] as $index => $page_id)
$_POST['remove'][(int) $index] = (int) $page_id;
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_shoutboxes
WHERE id_shoutbox IN ({array_int:shoutbox})',
array(
'shoutbox' => $_POST['remove'],
)
);
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_shouts
WHERE id_shoutbox IN ({array_int:shoutbox})',
array(
'shoutbox' => $_POST['remove'],
)
);
}
$sort_methods = array(
'name' => array(
'down' => 'name ASC',
'up' => 'name DESC'
),
'num_shouts' => array(
'down' => 'num_shouts ASC',
'up' => 'num_shouts DESC'
),
'caching' => array(
'down' => 'caching ASC',
'up' => 'caching DESC'
),
'status' => array(
'down' => 'status ASC',
'up' => 'status DESC'
),
);
$context['columns'] = array(
'name' => array(
'width' => '40%',
'label' => $txt['sp_admin_shoutbox_col_name'],
'class' => 'first_th',
'sortable' => true
),
'num_shouts' => array(
'width' => '15%',
'label' => $txt['sp_admin_shoutbox_col_shouts'],
'sortable' => true
),
'caching' => array(
'width' => '15%',
'label' => $txt['sp_admin_shoutbox_col_caching'],
'sortable' => true
),
'status' => array(
'width' => '15%',
'label' => $txt['sp_admin_shoutbox_col_status'],
'sortable' => true
),
'actions' => array(
'width' => '15%',
'label' => $txt['sp_admin_shoutbox_col_actions'],
'sortable' => false
),
);
if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']]))
$_REQUEST['sort'] = 'name';
foreach ($context['columns'] as $col => $dummy)
{
$context['columns'][$col]['selected'] = $col == $_REQUEST['sort'];
$context['columns'][$col]['href'] = $scripturl . '?action=admin;area=portalshoutbox;sa=list;sort=' . $col;
if (!isset($_REQUEST['desc']) && $col == $_REQUEST['sort'])
$context['columns'][$col]['href'] .= ';desc';
$context['columns'][$col]['link'] = '<a href="' . $context['columns'][$col]['href'] . '">' . $context['columns'][$col]['label'] . '</a>';
}
$context['sort_by'] = $_REQUEST['sort'];
$context['sort_direction'] = !isset($_REQUEST['desc']) ? 'down' : 'up';
$request = $smcFunc['db_query']('','
SELECT COUNT(*)
FROM {db_prefix}sp_shoutboxes'
);
list ($total_shoutbox) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['page_index'] = constructPageIndex($scripturl . '?action=admin;area=portalshoutbox;sa=list;sort=' . $_REQUEST['sort'] . (isset($_REQUEST['desc']) ? ';desc' : ''), $_REQUEST['start'], $total_shoutbox, 20);
$context['start'] = $_REQUEST['start'];
$request = $smcFunc['db_query']('','
SELECT id_shoutbox, name, caching, status, num_shouts
FROM {db_prefix}sp_shoutboxes
ORDER BY id_shoutbox, {raw:sort}
LIMIT {int:start}, {int:limit}',
array(
'sort' => $sort_methods[$_REQUEST['sort']][$context['sort_direction']],
'start' => $context['start'],
'limit' => 20,
)
);
$context['shoutboxes'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$context['shoutboxes'][$row['id_shoutbox']] = array(
'id' => $row['id_shoutbox'],
'name' => $row['name'],
'shouts' => $row['num_shouts'],
'caching' => $row['caching'],
'status' => $row['status'],
'status_image' => '<a href="' . $scripturl . '?action=admin;area=portalshoutbox;sa=status;shoutbox_id=' . $row['id_shoutbox'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . sp_embed_image(empty($row['status']) ? 'deactive' : 'active', $txt['sp_admin_shoutbox_' . (!empty($row['status']) ? 'de' : '') . 'activate']) . '</a>',
'actions' => array(
'edit' => '<a href="' . $scripturl . '?action=admin;area=portalshoutbox;sa=edit;shoutbox_id=' . $row['id_shoutbox'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . sp_embed_image('modify') . '</a>',
'prune' => '<a href="' . $scripturl . '?action=admin;area=portalshoutbox;sa=prune;shoutbox_id=' . $row['id_shoutbox'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . sp_embed_image('bin') . '</a>',
'delete' => '<a href="' . $scripturl . '?action=admin;area=portalshoutbox;sa=delete;shoutbox_id=' . $row['id_shoutbox'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="return confirm(\'', $txt['sp_admin_shoutbox_delete_confirm'], '\');">' . sp_embed_image('delete') . '</a>',
)
);
}
$smcFunc['db_free_result']($request);
$context['sub_template'] = 'shoutbox_list';
$context['page_title'] = $txt['sp_admin_shoutbox_list'];
}
function sportal_admin_shoutbox_edit()
{
global $txt, $context, $modSettings, $smcFunc;
$context['SPortal']['is_new'] = empty($_REQUEST['shoutbox_id']);
if (!empty($_POST['submit']))
{
checkSession();
if (!isset($_POST['name']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['name'], ENT_QUOTES)) === '')
fatal_lang_error('sp_error_shoutbox_name_empty', false);
$result = $smcFunc['db_query']('','
SELECT id_shoutbox
FROM {db_prefix}sp_shoutboxes
WHERE name = {string:name}
AND id_shoutbox != {int:current}
LIMIT 1',
array(
'limit' => 1,
'name' => $smcFunc['htmlspecialchars']($_POST['name'], ENT_QUOTES),
'current' => (int) $_POST['shoutbox_id'],
)
);
list ($has_duplicate) = $smcFunc['db_fetch_row']($result);
$smcFunc['db_free_result']($result);
if (!empty($has_duplicate))
fatal_lang_error('sp_error_shoutbox_name_duplicate', false);
$permission_set = 0;
$groups_allowed = $groups_denied = '';
if (!empty($_POST['permission_set']))
$permission_set = (int) $_POST['permission_set'];
elseif (!empty($_POST['membergroups']) && is_array($_POST['membergroups']))
{
$groups_allowed = $groups_denied = array();
foreach ($_POST['membergroups'] as $id => $value)
{
if ($value == 1)
$groups_allowed[] = (int) $id;
elseif ($value == -1)
$groups_denied[] = (int) $id;
}
$groups_allowed = implode(',', $groups_allowed);
$groups_denied = implode(',', $groups_denied);
}
if (isset($_POST['moderator_groups']) && is_array($_POST['moderator_groups']) && count($_POST['moderator_groups']) > 0)
{
foreach ($_POST['moderator_groups'] as $id => $group)
$_POST['moderator_groups'][$id] = (int) $group;
$_POST['moderator_groups'] = implode(',', $_POST['moderator_groups']);
}
else
$_POST['moderator_groups'] = '';
if (!empty($_POST['allowed_bbc']) && is_array($_POST['allowed_bbc']))
{
foreach ($_POST['allowed_bbc'] as $id => $tag)
$_POST['allowed_bbc'][$id] = $smcFunc['htmlspecialchars']($tag, ENT_QUOTES);
$_POST['allowed_bbc'] = implode(',', $_POST['allowed_bbc']);
}
else
$_POST['allowed_bbc'] = '';
$fields = array(
'name' => 'string',
'permission_set' => 'int',
'groups_allowed' => 'string',
'groups_denied' => 'string',
'moderator_groups' => 'string',
'warning' => 'string',
'allowed_bbc' => 'string',
'height' => 'int',
'num_show' => 'int',
'num_max' => 'int',
'reverse' => 'int',
'caching' => 'int',
'refresh' => 'int',
'status' => 'int',
);
$shoutbox_info = array(
'id' => (int) $_POST['shoutbox_id'],
'name' => $smcFunc['htmlspecialchars']($_POST['name'], ENT_QUOTES),
'permission_set' => $permission_set,
'groups_allowed' => $groups_allowed,
'groups_denied' => $groups_denied,
'moderator_groups' => $_POST['moderator_groups'],
'warning' => $smcFunc['htmlspecialchars']($_POST['warning'], ENT_QUOTES),
'allowed_bbc' => $_POST['allowed_bbc'],
'height' => (int) $_POST['height'],
'num_show' => (int) $_POST['num_show'],
'num_max' => (int) $_POST['num_max'],
'reverse' => !empty($_POST['reverse']) ? 1 : 0,
'caching' => !empty($_POST['caching']) ? 1 : 0,
'refresh' => (int) $_POST['refresh'],
'status' => !empty($_POST['status']) ? 1 : 0,
);
if ($context['SPortal']['is_new'])
{
unset($shoutbox_info['id']);
$smcFunc['db_insert']('',
'{db_prefix}sp_shoutboxes',
$fields,
$shoutbox_info,
array('id_shoutbox')
);
$shoutbox_info['id'] = $smcFunc['db_insert_id']('{db_prefix}sp_shoutboxes', 'id_shoutbox');
}
else
{
$update_fields = array();
foreach ($fields as $name => $type)
$update_fields[] = $name . ' = {' . $type . ':' . $name . '}';
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_shoutboxes
SET ' . implode(', ', $update_fields) . '
WHERE id_shoutbox = {int:id}',
$shoutbox_info
);
}
sportal_update_shoutbox($shoutbox_info['id']);
if ($context['SPortal']['is_new'] && (allowedTo(array('sp_admin', 'sp_manage_blocks'))))
redirectexit('action=admin;area=portalshoutbox;sa=blockredirect;shoutbox=' . $shoutbox_info['id']);
else
redirectexit('action=admin;area=portalshoutbox');
}
if ($context['SPortal']['is_new'])
{
$context['SPortal']['shoutbox'] = array(
'id' => 0,
'name' => $txt['sp_shoutbox_default_name'],
'permission_set' => 3,
'groups_allowed' => array(),
'groups_denied' => array(),
'moderator_groups' => array(),
'warning' => '',
'allowed_bbc' => array('b', 'i', 'u', 's', 'url', 'code', 'quote', 'me'),
'height' => 200,
'num_show' => 20,
'num_max' => 1000,
'reverse' => 0,
'caching' => 1,
'refresh' => 0,
'status' => 1,
);
}
else
{
$_REQUEST['shoutbox_id'] = (int) $_REQUEST['shoutbox_id'];
$context['SPortal']['shoutbox'] = sportal_get_shoutbox($_REQUEST['shoutbox_id']);
}
loadLanguage('Post');
$context['SPortal']['shoutbox']['groups'] = sp_load_membergroups();
sp_loadMemberGroups($context['SPortal']['shoutbox']['moderator_groups'], 'moderator', 'moderator_groups');
$context['allowed_bbc'] = array(
'b' => $txt['bold'],
'i' => $txt['italic'],
'u' => $txt['underline'],
's' => $txt['strike'],
'pre' => $txt['preformatted'],
'flash' => $txt['flash'],
'img' => $txt['image'],
'url' => $txt['hyperlink'],
'email' => $txt['insert_email'],
'ftp' => $txt['ftp'],
'glow' => $txt['glow'],
'shadow' => $txt['shadow'],
'sup' => $txt['superscript'],
'sub' => $txt['subscript'],
'tt' => $txt['teletype'],
'code' => $txt['bbc_code'],
'quote' => $txt['bbc_quote'],
'size' => $txt['font_size'],
'font' => $txt['font_face'],
'color' => $txt['change_color'],
'me' => 'me',
);
$disabled_tags = array();
if (!empty($modSettings['disabledBBC']))
$disabled_tags = explode(',', $modSettings['disabledBBC']);
if (empty($modSettings['enableEmbeddedFlash']))
$disabled_tags[] = 'flash';
foreach ($disabled_tags as $tag)
{
if ($tag == 'list')
$context['disabled_tags']['orderlist'] = true;
$context['disabled_tags'][trim($tag)] = true;
}
$context['page_title'] = $context['SPortal']['is_new'] ? $txt['sp_admin_shoutbox_add'] : $txt['sp_admin_shoutbox_edit'];
$context['sub_template'] = 'shoutbox_edit';
}
function sportal_admin_shoutbox_prune()
{
global $smcFunc, $context, $txt;
$shoutbox_id = empty($_REQUEST['shoutbox_id']) ? 0 : (int) $_REQUEST['shoutbox_id'];
$context['shoutbox'] = sportal_get_shoutbox($shoutbox_id);
if (empty($context['shoutbox']))
fatal_lang_error('error_sp_shoutbox_not_exist', false);
if (!empty($_POST['submit']))
{
checkSession();
if (!empty($_POST['type']))
{
$where = array('id_shoutbox = {int:shoutbox_id}');
$parameters = array('shoutbox_id' => $shoutbox_id);
if ($_POST['type'] == 'days' && !empty($_POST['days']))
{
$where[] = 'log_time < {int:time_limit}';
$parameters['time_limit'] = time() - $_POST['days'] * 86400;
}
elseif ($_POST['type'] == 'member' && !empty($_POST['member']))
{
$request = $smcFunc['db_query']('', '
SELECT id_member
FROM {db_prefix}members
WHERE member_name = {string:member}
OR real_name = {string:member}
LIMIT {int:limit}',
array(
'member' => strtr(trim($smcFunc['htmlspecialchars']($_POST['member'], ENT_QUOTES)), array('\'' => '&#039;')),
'limit' => 1,
)
);
list ($member_id) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
if (!empty($member_id))
{
$where[] = 'id_member = {int:member_id}';
$parameters['member_id'] = $member_id;
}
}
if ($_POST['type'] == 'all' || count($where) > 1)
{
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_shouts
WHERE ' . implode(' AND ', $where),
$parameters
);
if ($_POST['type'] != 'all')
{
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}sp_shouts
WHERE id_shoutbox = {int:shoutbox_id}
LIMIT {int:limit}',
array(
'shoutbox_id' => $shoutbox_id,
'limit' => 1,
)
);
list ($total_shouts) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
}
else
$total_shouts = 0;
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_shoutboxes
SET num_shouts = {int:total_shouts}
WHERE id_shoutbox = {int:shoutbox_id}',
array(
'shoutbox_id' => $shoutbox_id,
'total_shouts' => $total_shouts,
)
);
sportal_update_shoutbox($shoutbox_id);
}
}
redirectexit('action=admin;area=portalshoutbox');
}
$context['page_title'] = $txt['sp_admin_shoutbox_prune'];
$context['sub_template'] = 'shoutbox_prune';
}
function sportal_admin_shoutbox_delete()
{
global $smcFunc;
checkSession('get');
$shoutbox_id = !empty($_REQUEST['shoutbox_id']) ? (int) $_REQUEST['shoutbox_id'] : 0;
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_shoutboxes
WHERE id_shoutbox = {int:id}',
array(
'id' => $shoutbox_id,
)
);
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_shouts
WHERE id_shoutbox = {int:id}',
array(
'id' => $shoutbox_id,
)
);
redirectexit('action=admin;area=portalshoutbox');
}
function sportal_admin_shoutbox_status()
{
global $smcFunc;
checkSession('get');
$shoutbox_id = !empty($_REQUEST['shoutbox_id']) ? (int) $_REQUEST['shoutbox_id'] : 0;
$smcFunc['db_query']('', '
UPDATE {db_prefix}sp_shoutboxes
SET status = CASE WHEN status = {int:is_active} THEN 0 ELSE 1 END
WHERE id_shoutbox = {int:id}',
array(
'is_active' => 1,
'id' => $shoutbox_id,
)
);
redirectexit('action=admin;area=portalshoutbox');
}
function sportal_admin_shoutbox_block_redirect()
{
global $context, $scripturl, $txt;
if (!allowedTo('sp_admin'))
isAllowedTo('sp_manage_blocks');
$context['page_title'] = $txt['sp_admin_shoutbox_add'];
$context['redirect_message'] = sprintf($txt['sp_admin_shoutbox_block_redirect_message'], $scripturl . '?action=admin;area=portalblocks;sa=add;selected_type=sp_shoutbox;parameters[]=shoutbox;shoutbox=' . $_GET['shoutbox'], $scripturl . '?action=admin;area=portalshoutbox');
$context['sub_template'] = 'shoutbox_block_redirect';
}
?>

325
Sources/PortalArticles.php Normal file
View File

@ -0,0 +1,325 @@
<?php
/**********************************************************************************
* PortalArticles.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_articles()
// !!!
array sportal_articles_callback()
// !!!
void sportal_add_article()
// !!!
void sportal_remove_article()
// !!!
*/
function sportal_articles()
{
global $smcFunc, $context, $modSettings, $article_request;
loadLanguage('Stats');
loadTemplate('PortalArticles');
$context['sub_template'] = 'articles';
if (empty($modSettings['articleactive']))
return;
$request = $smcFunc['db_query']('','
SELECT COUNT(*)
FROM {db_prefix}sp_articles as a
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
WHERE {query_see_board}
AND a.approved = {int:approved}
AND publish = {int:publish}',
array(
'approved' => 1,
'publish' => 1,
)
);
list ($totalArticles) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$modSettings['articleperpage'] = isset($modSettings['articleperpage']) ? (int) $modSettings['articleperpage'] : 5;
$context['start'] = !empty($_REQUEST['articles']) ? (int) $_REQUEST['articles'] : 0;
if (!empty($modSettings['articleperpage']) && $totalArticles > 0)
$context['page_index'] = constructPageIndex($context['portal_url'] . '?articles=%1$d', $context['start'], $totalArticles, $modSettings['articleperpage'], true);
if (empty($modSettings['sp_disableColor']))
{
$members_request = $smcFunc['db_query']('','
SELECT m.id_member
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
WHERE {query_see_board}
AND a.approved = {int:approved}
AND publish = {int:publish}
AND m.id_member != {int:guest}
ORDER BY a.id_message DESC' . (empty($modSettings['articleperpage']) ? '' : '
LIMIT {int:start}, {int:end}'),
array(
'approved' => 1,
'publish' => 1,
'start' => $context['start'],
'end' => $modSettings['articleperpage'],
'guest' => 0,
)
);
$colorids = array();
while($row = $smcFunc['db_fetch_assoc']($members_request))
$colorids[] = $row['id_member'];
$smcFunc['db_free_result']($members_request);
if (!empty($colorids))
sp_loadColors($colorids);
}
$article_request = $smcFunc['db_query']('','
SELECT
a.id_article, a.id_category, a.id_message, a.approved, c.name as cname, c.picture, m.id_member,
IFNULL(mem.real_name, m.poster_name) AS poster_name, m.icon, m.subject, m.body, m.poster_time,
m.smileys_enabled, t.id_topic, t.num_replies, t.num_views, t.locked, b.id_board, b.name as bname,
mem.avatar, at.id_attach, at.attachment_type, at.filename
FROM {db_prefix}sp_articles AS a
INNER JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_message)
INNER JOIN {db_prefix}topics AS t ON (t.id_first_msg = a.id_message)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
LEFT JOIN {db_prefix}attachments AS at ON (at.id_member = mem.id_member)
WHERE {query_see_board}
AND a.approved = {int:approved}
AND publish = {int:publish}
ORDER BY a.id_message DESC' . (empty($modSettings['articleperpage']) ? '' : '
LIMIT {int:start}, {int:end}'),
array(
'approved' => 1,
'publish' => 1,
'start' => $context['start'],
'end' => $modSettings['articleperpage'],
)
);
$context['get_articles'] = 'sportal_articles_callback';
}
function sportal_articles_callback($reset = false)
{
global $smcFunc, $context, $scripturl, $modSettings, $settings, $txt, $color_profile, $article_request, $current;
if ($article_request == false)
return false;
if (!($row = $smcFunc['db_fetch_assoc']($article_request)))
return false;
if (!empty($current) && $current == $row['id_message'])
return;
$current = $row['id_message'];
$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';
$limited = false;
if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false)
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
$limited = true;
}
elseif (!empty($modSettings['articlelength']) && $smcFunc['strlen']($row['body']) > $modSettings['articlelength'])
{
$row['body'] = $smcFunc['substr']($row['body'], 0, $modSettings['articlelength']);
$limited = true;
}
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_message']);
// Only place an ellipsis if the body has been shortened.
if ($limited)
$row['body'] .= '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0" title="' . $row['subject'] . '">...</a>';
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}
if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';
censorText($row['subject']);
censorText($row['body']);
if ($modSettings['sp_resize_images'])
$row['body'] = preg_replace('~class="bbc_img~i', 'class="bbc_img sp_article', $row['body']);
$output = array(
'article' => array(
'id' => $row['id_article'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'],
'comment_link' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . ';num_replies=' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '| <a href="' . $scripturl . '?action=post;topic=' . $row['id_topic'] . '.' . $row['num_replies'] . '">' . $txt['ssi_write_comment'] . '</a>',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $txt['sp-read_more'] . '</a>',
'approved' => $row['approved'],
),
'category' => array(
'id' => $row['id_category'],
'name' => $row['cname'],
'picture' => array (
'href' => $row['picture'],
'image' => '<img src="' . $row['picture'] . '" alt="' . $row['cname'] . '" width="75" />',
),
),
'message' => array(
'id' => $row['id_message'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'body' => $row['body'],
'time' => timeformat($row['poster_time']),
),
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => !empty($row['id_member']) ? $scripturl . '?action=profile;u=' . $row['id_member'] : '',
'link' => !empty($row['id_member']) ? (!empty($color_profile[$row['id_member']]['link']) ? $color_profile[$row['id_member']]['link'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>') : $row['poster_name'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
),
'topic' => array(
'id' => $row['id_topic'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0">' . $row['subject'] . '</a>',
'locked' => !empty($row['locked']),
),
'board' => array(
'id' => $row['id_board'],
'name' => $row['bname'],
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>',
),
);
return $output;
}
function sportal_add_article()
{
global $smcFunc, $context, $scripturl, $sourcedir, $txt;
if (!allowedTo(array('sp_add_article', 'sp_manage_articles', 'sp_admin')))
fatal_lang_error('error_sp_cannot_add_article');
require_once($sourcedir . '/Subs-PortalAdmin.php');
loadLanguage('SPortalAdmin', sp_languageSelect('SPortalAdmin'));
loadTemplate('PortalArticles');
if (!empty($_POST['add_article']))
{
$article_options = array(
'id_category' => !empty($_POST['category']) ? (int) $_POST['category'] : 0,
'id_message' => !empty($_POST['message']) ? (int) $_POST['message'] : 0,
'approved' => allowedTo(array('sp_admin', 'sp_manage_articles', 'sp_auto_article_approval')) ? 1 : 0,
);
createArticle($article_options);
redirectexit('topic=' . $_POST['return']);
}
$context['message'] = !empty($_REQUEST['message']) ? (int) $_REQUEST['message'] : 0;
$context['return'] = !empty($_REQUEST['return']) ? $_REQUEST['return'] : '';
if (empty($context['message']))
fatal_lang_error('error_sp_no_message_id');
$request = $smcFunc['db_query']('','
SELECT id_message
FROM {db_prefix}sp_articles
WHERE id_message = {int:message}',
array(
'message' => $context['message'],
)
);
list ($exists) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
if ($exists)
fatal_lang_error('error_sp_article_exists');
$context['list_categories'] = getCategoryInfo(null, true);
if (empty($context['list_categories']))
fatal_error(allowedTo(array('sp_admin', 'sp_manage_articles')) ? $txt['error_sp_no_category'] . '<br />' . sprintf($txt['error_sp_no_category_sp_moderator'], $scripturl . '?action=admin;area=portalarticles;sa=addcategory') : $txt['error_sp_no_category_normaluser'], false);
$context['sub_template'] = 'add_article';
}
function sportal_remove_article()
{
global $smcFunc, $sourcedir;
checkSession('get');
if (!allowedTo(array('sp_remove_article', 'sp_manage_articles', 'sp_admin')))
fatal_lang_error('error_sp_cannot_remove_article');
require_once($sourcedir . '/Subs-PortalAdmin.php');
$message_id = !empty($_REQUEST['message']) ? (int) $_REQUEST['message'] : 0;
$topic_id = !empty($_REQUEST['return']) ? $_REQUEST['return'] : '';
$smcFunc['db_query']('','
DELETE FROM {db_prefix}sp_articles
WHERE id_message = {int:message}',
array(
'message' => $message_id,
)
);
fixCategoryArticles();
redirectexit('topic=' . $topic_id);
}
?>

3564
Sources/PortalBlocks.php Normal file

File diff suppressed because it is too large Load Diff

81
Sources/PortalMain.php Normal file
View File

@ -0,0 +1,81 @@
<?php
/**********************************************************************************
* PortalMain.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_main()
// !!!
void sportal_credits()
// !!!
*/
function sportal_main()
{
global $smcFunc, $context, $sourcedir;
if (WIRELESS)
redirectexit('action=forum');
$context['page_title'] = $context['forum_name'];
if (isset($context['page_title_html_safe']))
$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
if (!empty($context['standalone']))
setupMenuContext();
$actions = array(
'addarticle' => array('PortalArticles.php', 'sportal_add_article'),
'articles' => array('PortalArticles.php', 'sportal_articles'),
'credits' => array('', 'sportal_credits'),
'pages' => array('PortalPages.php', 'sportal_pages'),
'removearticle' => array('PortalArticles.php', 'sportal_remove_article'),
'shoutbox' => array('PortalShoutbox.php', 'sportal_shoutbox'),
);
if (!isset($_REQUEST['sa']) || !isset($actions[$_REQUEST['sa']]))
$_REQUEST['sa'] = 'articles';
if (!empty($actions[$_REQUEST['sa']][0]))
require_once($sourcedir . '/' . $actions[$_REQUEST['sa']][0]);
$actions[$_REQUEST['sa']][1]();
}
function sportal_credits()
{
global $sourcedir, $context, $txt;
require_once($sourcedir . '/PortalAdminMain.php');
loadLanguage('SPortalAdmin', sp_languageSelect('SPortalAdmin'));
sportal_information(false);
$context['page_title'] = $txt['sp-info_title'];
$context['sub_template'] = 'information';
}
?>

74
Sources/PortalPages.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/**********************************************************************************
* PortalPages.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_pages()
// !!!
*/
function sportal_pages()
{
global $smcFunc, $context, $txt, $scripturl, $sourcedir, $user_info;
loadTemplate('PortalPages');
$page_id = !empty($_REQUEST['page']) ? $_REQUEST['page'] : 0;
if (is_numeric($page_id))
$page_id = (int) $page_id;
else
$page_id = $smcFunc['htmlspecialchars']($page_id, ENT_QUOTES);
$context['SPortal']['page'] = sportal_get_pages($page_id, true, true);
if (empty($context['SPortal']['page']['id']))
fatal_lang_error('error_sp_page_not_found', false);
$context['SPortal']['page']['style'] = sportal_parse_style('explode', $context['SPortal']['page']['style'], true);
if (empty($_SESSION['last_viewed_page']) || $_SESSION['last_viewed_page'] != $context['SPortal']['page']['id'])
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}sp_pages
SET views = views + 1
WHERE id_page = {int:current_page}',
array(
'current_page' => $context['SPortal']['page']['id'],
)
);
$_SESSION['last_viewed_page'] = $context['SPortal']['page']['id'];
}
$context['linktree'][] = array(
'url' => $scripturl . '?page=' . $page_id,
'name' => $context['SPortal']['page']['title'],
);
$context['page_title'] = $context['SPortal']['page']['title'];
$context['sub_template'] = 'view_page';
}
?>

131
Sources/PortalShoutbox.php Normal file
View File

@ -0,0 +1,131 @@
<?php
/**********************************************************************************
* PortalShoutbox.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_shoutbox()
// !!!
*/
function sportal_shoutbox()
{
global $smcFunc, $context, $scripturl, $txt, $sourcedir, $user_info;
$shoutbox_id = !empty($_REQUEST['shoutbox_id']) ? (int) $_REQUEST['shoutbox_id'] : 0;
$request_time = !empty($_REQUEST['time']) ? (int) $_REQUEST['time'] : 0;
$context['SPortal']['shoutbox'] = sportal_get_shoutbox($shoutbox_id, true, true);
if (empty($context['SPortal']['shoutbox']))
fatal_lang_error('error_sp_shoutbox_not_exist', false);
$context['SPortal']['shoutbox']['warning'] = parse_bbc($context['SPortal']['shoutbox']['warning']);
$can_moderate = allowedTo('sp_admin') || allowedTo('sp_manage_shoutbox');
if (!$can_moderate && !empty($context['SPortal']['shoutbox']['moderator_groups']))
$can_moderate = count(array_intersect($user_info['groups'], $context['SPortal']['shoutbox']['moderator_groups'])) > 0;
if (!empty($_REQUEST['shout']))
{
checkSession('request');
is_not_guest();
if (!($flood = sp_prevent_flood('spsbp', false)))
{
require_once($sourcedir . '/Subs-Post.php');
$_REQUEST['shout'] = $smcFunc['htmlspecialchars'](trim($_REQUEST['shout']));
preparsecode($_REQUEST['shout']);
if (!empty($_REQUEST['shout']))
sportal_create_shout($context['SPortal']['shoutbox'], $_REQUEST['shout']);
}
else
$context['SPortal']['shoutbox']['warning'] = $flood;
}
if (!empty($_REQUEST['delete']))
{
checkSession('request');
if (!$can_moderate)
fatal_lang_error('error_sp_cannot_shoutbox_moderate', false);
$_REQUEST['delete'] = (int) $_REQUEST['delete'];
if (!empty($_REQUEST['delete']))
sportal_delete_shout($shoutbox_id, $_REQUEST['delete']);
}
loadTemplate('PortalShoutbox');
if (isset($_REQUEST['xml']))
{
$shout_parameters = array(
'limit' => $context['SPortal']['shoutbox']['num_show'],
'bbc' => $context['SPortal']['shoutbox']['allowed_bbc'],
'reverse' => $context['SPortal']['shoutbox']['reverse'],
'cache' => $context['SPortal']['shoutbox']['caching'],
'can_moderate' => $can_moderate,
);
$context['SPortal']['shouts'] = sportal_get_shouts($shoutbox_id, $shout_parameters);
$context['sub_template'] = 'shoutbox_xml';
$context['SPortal']['updated'] = empty($context['SPortal']['shoutbox']['last_update']) || $context['SPortal']['shoutbox']['last_update'] > $request_time;
return;
}
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}sp_shouts
WHERE id_shoutbox = {int:current}',
array(
'current' => $shoutbox_id,
)
);
list ($total_shouts) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$context['per_page'] = $context['SPortal']['shoutbox']['num_show'];
$context['start'] = !empty($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
$context['page_index'] = constructPageIndex($scripturl . '?action=portal;sa=shoutbox;shoutbox_id=' . $shoutbox_id, $context['start'], $total_shouts, $context['per_page']);
$shout_parameters = array(
'start' => $context['start'],
'limit' => $context['per_page'],
'bbc' => $context['SPortal']['shoutbox']['allowed_bbc'],
'cache' => $context['SPortal']['shoutbox']['caching'],
'can_moderate' => $can_moderate,
);
$context['SPortal']['shouts_history'] = sportal_get_shouts($shoutbox_id, $shout_parameters);
$context['SPortal']['shoutbox_id'] = $shoutbox_id;
$context['sub_template'] = 'shoutbox_all';
$context['page_title'] = $context['SPortal']['shoutbox']['name'];
}
?>

View File

@ -454,6 +454,10 @@ function ob_sessrewrite($buffer)
{
global $scripturl, $modSettings, $user_info, $context;
// 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.
if ($scripturl == '' || !defined('SID'))
return $buffer;
@ -471,9 +475,9 @@ function ob_sessrewrite($buffer)
{
// Let's do something special for session ids!
if (defined('SID') && SID != '')
$buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#"]+?)(#[^"]*?)?"~', create_function('$m', 'global $scripturl; return \'"\' . $scripturl . "/" . strtr("$m[1]", \'&;=\', \'//,\') . ".html?" . SID . (isset($m[2]) ? $m[2] : "") . \'"\';'), $buffer);
$buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic|page)=[^#"]+?)(#[^"]*?)?"~', create_function('$m', 'global $scripturl; return \'"\' . $scripturl . "/" . strtr("$m[1]", \'&;=\', \'//,\') . ".html?" . SID . (isset($m[2]) ? $m[2] : "") . \'"\';'), $buffer);
else
$buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"~', create_function('$m', 'global $scripturl; return \'"\' . $scripturl . "/" . strtr("$m[1]", \'&;=\', \'//,\') . ".html" . (isset($m[2]) ? $m[2] : "") . \'"\';'), $buffer);
$buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?((?:board|topic|page)=[^#"]+?)(#[^"]*?)?"~', create_function('$m', 'global $scripturl; return \'"\' . $scripturl . "/" . strtr("$m[1]", \'&;=\', \'//,\') . ".html" . (isset($m[2]) ? $m[2] : "") . \'"\';'), $buffer);
}
// Return the changed buffer.

View File

@ -113,7 +113,7 @@ function RecentPosts()
fatal_lang_error('no_access', false);
$context['linktree'][] = array(
'url' => $scripturl . '#c' . (int) $_REQUEST['c'],
'url' => $scripturl . '?action=forum#c' . (int) $_REQUEST['c'],
'name' => $name
);
}
@ -327,8 +327,8 @@ function RecentPosts()
'category' => array(
'id' => $row['id_cat'],
'name' => $row['cname'],
'href' => $scripturl . '#c' . $row['id_cat'],
'link' => '<a href="' . $scripturl . '#c' . $row['id_cat'] . '">' . $row['cname'] . '</a>'
'href' => $scripturl . '?action=forum#c' . $row['id_cat'],
'link' => '<a href="' . $scripturl . '?action=forum#c' . $row['id_cat'] . '">' . $row['cname'] . '</a>'
),
'board' => array(
'id' => $row['id_board'],
@ -629,7 +629,7 @@ function UnreadTopics()
$smcFunc['db_free_result']($request);
$context['linktree'][] = array(
'url' => $scripturl . '#c' . (int) $_REQUEST['c'][0],
'url' => $scripturl . '?action=forum#c' . (int) $_REQUEST['c'][0],
'name' => $name
);
}

View File

@ -107,7 +107,7 @@ function getBoardIndex($boardIndexOptions)
'can_collapse' => isset($row_board['can_collapse']) && $row_board['can_collapse'] == 1,
'collapse_href' => isset($row_board['can_collapse']) ? $scripturl . '?action=collapse;c=' . $row_board['id_cat'] . ';sa=' . ($row_board['is_collapsed'] > 0 ? 'expand;' : 'collapse;') . $context['session_var'] . '=' . $context['session_id'] . '#c' . $row_board['id_cat'] : '',
'collapse_image' => isset($row_board['can_collapse']) ? '<img src="' . $settings['images_url'] . '/' . $context['theme_variant_url'] . ($row_board['is_collapsed'] > 0 ? 'expand.gif" alt="+"' : 'collapse.gif" alt="-"') . ' />' : '',
'href' => $scripturl . '#c' . $row_board['id_cat'],
'href' => $scripturl . '?action=forum#c' . $row_board['id_cat'],
'boards' => array(),
'new' => false
);

View File

@ -220,7 +220,7 @@ function MarkRead()
if (isset($_SESSION['topicseen_cache']))
$_SESSION['topicseen_cache'] = array();
redirectexit();
redirectexit('action=forum');
}
elseif (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'unreadreplies')
{

1441
Sources/Subs-Portal.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,548 @@
<?php
/**********************************************************************************
* Subs-PortalAdmin.php *
***********************************************************************************
* SimplePortal *
* SMF Modification Project Founded by [SiNaN] (sinan@simplemachines.org) *
* =============================================================================== *
* Software Version: SimplePortal 2.3.5 *
* Software by: SimplePortal Team (http://www.simpleportal.net) *
* Copyright 2008-2009 by: SimplePortal Team (http://www.simpleportal.net) *
* Support, News, Updates at: http://www.simpleportal.net *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Simple Machines LLC. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Simple Machines license. *
* The latest version can always be found at http://www.simplemachines.org. *
**********************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');
/*
void sportal_admin_state_change()
// !!!
array getFunctionInfo()
// !!!
array getArticleInfo()
// !!!
void createArticle()
// !!!
array getCategoryInfo()
// !!!
void fixCategoryArticles()
// !!!
void fixColumnRows()
// !!!
void changeBlockRow()
// !!!
void changeState()
// !!!
string sp_validate_php()
// !!!
void sp_loadMembergroups()
// !!!
*/
function sportal_admin_state_change()
{
checkSession('get');
if (!empty($_REQUEST['block_id']))
$id = (int) $_REQUEST['block_id'];
elseif (!empty($_REQUEST['category_id']))
$id = (int) $_REQUEST['category_id'];
elseif (!empty($_REQUEST['article_id']))
$id = (int) $_REQUEST['article_id'];
else
fatal_lang_error('error_sp_id_empty', false);
changeState($_REQUEST['type'], $id);
if($_REQUEST['type'] == 'block')
{
$sides = array(1 => 'left', 2 => 'top', 3 => 'bottom', 4 => 'right');
$list = !empty($_GET['redirect']) && isset($sides[$_GET['redirect']]) ? $sides[$_GET['redirect']] : 'list';
redirectexit('action=admin;area=portalblocks;sa=' . $list);
}
elseif($_REQUEST['type'] == 'category')
redirectexit('action=admin;area=portalarticles;sa=categories');
elseif($_REQUEST['type'] == 'article')
redirectexit('action=admin;area=portalarticles;sa=articles');
else
redirectexit('action=admin;area=portalconfig');
}
function getFunctionInfo($function = null)
{
global $smcFunc;
$request = $smcFunc['db_query']('','
SELECT id_function, name
FROM {db_prefix}sp_functions' . (!empty($function) ? '
WHERE name = {string:function}' : '') . '
ORDER BY function_order',
array(
'function' => $function,
)
);
$return = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if ($row['name'] == 'sp_php' && !allowedTo('admin_forum'))
continue;
$return[] = array(
'id' => $row['id_function'],
'function' => $row['name'],
);
}
$smcFunc['db_free_result']($request);
return $return;
}
function getArticleInfo($article_id = null, $category_id = null, $message_id = null, $approved = null)
{
global $smcFunc;
$query = array();
if (!empty($article_id))
$query[] = "id_article = {int:article_id}";
if (!empty($category_id))
$query[] = "id_category = {int:category_id}";
if (!empty($message_id))
$query[] = "id_message = {int:message_id}";
if (!empty($approved))
$query[] = "approved = '{int:approved}'";
$request = $smcFunc['db_query']('','
SELECT a.id_article, a.id_category, a.id_message, a.approved, c.name
FROM {db_prefix}sp_articles as a
LEFT JOIN {db_prefix}sp_categories AS c ON (c.id_category = a.id_category)' . (!empty($query) ? '
WHERE ' . implode(' AND ', $query) : '') .'
ORDER BY id_article',
array(
'article_id' => $article_id,
'category_id' => $category_id,
'message_id' => $message_id,
'approved' => 1,
)
);
$return = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$return[] = array(
'article' => array(
'id' => $row['id_article'],
'approved' => $row['approved'],
),
'category' => array(
'id' => $row['id_category'],
'name' => $row['name'],
),
'message' => array(
'id' => $row['id_message'],
),
);
}
$smcFunc['db_free_result']($request);
return $return;
}
function createArticle($articleOptions)
{
global $smcFunc;
$articleOptions['id_category'] = !empty($articleOptions['id_category']) ? (int) $articleOptions['id_category'] : 0;
$articleOptions['id_message'] = !empty($articleOptions['id_message']) ? (int) $articleOptions['id_message'] : 0;
$articleOptions['approved'] = !empty($articleOptions['approved']) ? (int) $articleOptions['approved'] : 0;
$request = $smcFunc['db_query']('','
SELECT id_message
FROM {db_prefix}sp_articles
WHERE id_message = {int:id_message}',
array(
'id_message' => $articleOptions['id_message'],
)
);
list ($exists) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
if (empty($articleOptions['id_category']) || empty($articleOptions['id_message']) || $exists)
return false;
$smcFunc['db_insert']('normal', '{db_prefix}sp_articles',
array('id_category' => 'int', 'id_message' => 'int', 'approved' => 'int'),
array($articleOptions['id_category'], $articleOptions['id_message'], $articleOptions['approved']),
array('id_article')
);
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_categories
SET articles = articles + 1
WHERE id_category = {int:id_category}',
array(
'id_category' => $articleOptions['id_category'],
)
);
}
function getCategoryInfo($category_id = null, $publish = false)
{
global $scripturl, $context, $smcFunc, $settings, $txt;
$query = array();
$parameters = array();
if (!empty($category_id))
{
$query[] = 'id_category = {int:category_id}';
$parameters['category_id'] = $category_id;
}
if (!empty($publish))
{
$query[] = 'publish = {int:publish}';
$parameters['publish'] = 1;
}
$request = $smcFunc['db_query']('','
SELECT id_category, name, picture, articles, publish
FROM {db_prefix}sp_categories' . (!empty($query) ? '
WHERE ' . implode(' AND ', $query) : '') . '
ORDER BY id_category',
$parameters
);
$return = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$return[] = array(
'id' => $row['id_category'],
'name' => $row['name'],
'picture' => array (
'href' => $row['picture'],
'image' => '<img src="' . $row['picture'] . '" alt="' . $row['name'] . '" width="75" />',
),
'articles' => $row['articles'],
'publish' => $row['publish'],
);
}
$smcFunc['db_free_result']($request);
return $return;
}
function fixCategoryArticles()
{
global $smcFunc;
$categoryList = getCategoryInfo();
$categoryIds = array();
foreach ($categoryList as $category)
$categoryIds[] = $category['id'];
foreach ($categoryIds as $category)
{
$article_count = 0;
$request = $smcFunc['db_query']('','
SELECT COUNT(*)
FROM {db_prefix}sp_articles
WHERE id_category = {int:id_category}',
array(
'id_category' => $category,
)
);
list ($article_count) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_categories
SET articles = {int:article_count}
WHERE id_category = {int:id_category}',
array(
'article_count' => $article_count,
'id_category' => $category,
)
);
}
}
function fixColumnRows($column_id = null)
{
global $smcFunc;
$blockList = getBlockInfo($column_id);
$blockIds = array();
foreach($blockList as $block)
$blockIds[] = $block['id'];
$counter = 0;
foreach ($blockIds as $block)
{
$counter = $counter + 1;
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_blocks
SET row = {int:counter}
WHERE id_block = {int:block}',
array(
'counter' => $counter,
'block' => $block,
)
);
}
}
function changeState($type = null, $id = null)
{
global $smcFunc;
if ($type == 'block')
$query = array(
'column' => 'state',
'table' => 'blocks',
'query_id' => 'id_block',
'id' => $id
);
elseif ($type == 'category')
$query = array(
'column' => 'publish',
'table' => 'categories',
'query_id' => 'id_category',
'id' => $id
);
elseif ($type == 'article')
$query = array(
'column' => 'approved',
'table' => 'articles',
'query_id' => 'id_article',
'id' => $id
);
else
return false;
$request = $smcFunc['db_query']('','
SELECT {raw:column}
FROM {db_prefix}sp_{raw:table}
WHERE {raw:query_id} = {int:id}',
$query
);
list ($state) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$state = (int) $state;
$state = $state == 1 ? 0 : 1 ;
$smcFunc['db_query']('','
UPDATE {db_prefix}sp_{raw:table}
SET {raw:column} = {int:state}
WHERE {raw:query_id} = {int:id}',
array(
'table' => $query['table'],
'column' => $query['column'],
'state' => $state,
'query_id' => $query['query_id'],
'id' => $id,
)
);
}
function sp_validate_php($code)
{
global $boardurl, $boarddir, $sourcedir, $modSettings;
$id = time();
$token = md5(mt_rand() . session_id() . (string) microtime() . $modSettings['rand_seed']);
$error = false;
$filename = 'sp_tmp_' . $id . '.php';
$code = trim($code);
if (substr($code, 0, 5) == '<?php')
$code = substr($code, 5);
if (substr($code, -2) == '?>')
$code = substr($code, 0, -2);
require_once($sourcedir . '/Subs-Package.php');
$content = '<?php
if (empty($_GET[\'token\']) || $_GET[\'token\'] !== \'' . $token . '\')
exit();
require_once(\'' . $boarddir . '/SSI.php\');
' . $code . '
?>';
$fp = fopen($boarddir . '/' . $filename, 'w');
fwrite($fp, $content);
fclose($fp);
if (!file_exists($boarddir . '/' . $filename))
return false;
$result = fetch_web_data($boardurl . '/' . $filename . '?token=' . $token);
if ($result === false)
$error = 'database';
elseif (preg_match('~ <b>(\d+)</b><br( /)?' . '>$~i', $result) != 0)
$error = 'syntax';
unlink($boarddir . '/' . $filename);
return $error;
}
/*
void sp_loadMemberGroups(Array $selectedGroups = array, Array $removeGroups = array(), string $show = 'normal', string $contextName = 'member_groups')
This will file the $context['member_groups'] to the given options
$selectedGroups means all groups who should be shown as selcted, if you like to check all than insert an 'all'
You can also Give the function a string with '2,3,4'
$removeGroups this group id should not shown in the list
$show have follow options
'normal' => will show all groups, and add a guest and regular member (Standard)
'post' => will load only post groups
'master' => will load only not postbased groups
$contextName where the datas should stored in the $context.
*/
function sp_loadMemberGroups($selectedGroups = array(), $show = 'normal', $contextName = 'member_groups', $subContext = 'SPortal')
{
global $context, $smcFunc, $txt;
// Some additional Language stings are needed
loadLanguage('ManageBoards');
// Make sure its empty
if (!empty($subContext))
$context[$subContext][$contextName] = array();
else
$context[$contextName] = array();
// Preseting some things :)
if (!is_array($selectedGroups))
$checked = strtolower($selectedGroups) == 'all';
else
$checked = false;
if (!$checked && isset($selectedGroups) && $selectedGroups === '0')
$selectedGroups = array(0);
elseif (!$checked && !empty($selectedGroups))
{
if (!is_array($selectedGroups))
$selectedGroups = explode(',', $selectedGroups);
// Remove all strings, i will only allowe ids :P
foreach ($selectedGroups as $k => $i)
$selectedGroups[$k] = (int) $i;
$selectedGroups = array_unique($selectedGroups);
}
else
$selectedGroups = array();
// Okay let's checkup the show function
$show_option = array(
'normal' => 'id_group != 3',
'moderator' => 'id_group != 1 AND id_group != 3',
'post' => 'min_posts != -1',
'master' => 'min_posts = -1 AND id_group != 3',
);
$show = strtolower($show);
if (!isset($show_option[$show]))
$show = 'normal';
// Guest and Members are added manually. Only on normal ond master View =)
if ($show == 'normal' || $show == 'master' || $show == 'moderator')
{
if ($show != 'moderator')
{
$context[$contextName][-1] = array(
'id' => -1,
'name' => $txt['membergroups_guests'],
'checked' => $checked || in_array(-1, $selectedGroups),
'is_post_group' => false,
);
}
$context[$contextName][0] = array(
'id' => 0,
'name' => $txt['membergroups_members'],
'checked' => $checked || in_array(0, $selectedGroups),
'is_post_group' => false,
);
}
// Load membergroups.
$request = $smcFunc['db_query']('', '
SELECT group_name, id_group, min_posts
FROM {db_prefix}membergroups
WHERE {raw:show}
ORDER BY min_posts, id_group != {int:global_moderator}, group_name',
array(
'show' => $show_option[$show],
'global_moderator' => 2,
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$context[$contextName][(int) $row['id_group']] = array(
'id' => $row['id_group'],
'name' => trim($row['group_name']),
'checked' => $checked || in_array($row['id_group'], $selectedGroups),
'is_post_group' => $row['min_posts'] != -1,
);
}
$smcFunc['db_free_result']($request);
}
function sp_load_membergroups()
{
global $smcFunc, $txt;
loadLanguage('ManageBoards');
$groups = array(
-1 => $txt['parent_guests_only'],
0 => $txt['parent_members_only'],
);
$request = $smcFunc['db_query']('', '
SELECT group_name, id_group, min_posts
FROM {db_prefix}membergroups
WHERE id_group != {int:moderator_group}
ORDER BY min_posts, group_name',
array(
'moderator_group' => 3,
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$groups[(int) $row['id_group']] = trim($row['group_name']);
$smcFunc['db_free_result']($request);
return $groups;
}
?>

View File

@ -969,7 +969,7 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
{
global $txt, $scripturl, $context, $modSettings, $user_info, $smcFunc;
static $bbc_codes = array(), $itemcodes = array(), $no_autolink_tags = array();
static $disabled;
static $disabled, $default_disabled, $parse_tag_cache;
// Don't waste cycles
if ($message === '')
@ -993,15 +993,19 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
if (!isset($context['utf8']))
$context['utf8'] = (empty($modSettings['global_character_set']) ? $txt['lang_character_set'] : $modSettings['global_character_set']) === 'UTF-8';
/*
// 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();
}
*/
// Sift out the bbc for a performance improvement.
if (empty($bbc_codes) || $message === false || !empty($parse_tags))
// 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)
{
if (!empty($modSettings['disabledBBC']))
{
@ -1782,12 +1786,41 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
foreach ($codes as $code)
{
// If we are not doing every tag only do ones we are interested in.
if (empty($parse_tags) || in_array($code['tag'], $parse_tags))
// 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($default_disabled))
$default_disabled = isset($disabled) ? $disabled : array();
if (isset($parse_tag_cache[$tags_cache_id]))
list ($bbc_codes, $disabled) = $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))
{
$disabled[$code['tag']] = true;
unset($bbc_codes[$key_bbc][$key_code]);
}
$parse_tag_cache = array($tags_cache_id => array($bbc_codes, $disabled));
}
}
elseif (isset($default_disabled))
$disabled = $default_disabled;
if (strpos($message, '[cutoff]') !== false)
$message = str_replace('[cutoff]', '', $message);
// Shall we take the time to cache this?
if ($cache_id != '' && !empty($modSettings['cache_enable']) && (($modSettings['cache_enable'] >= 2 && strlen($message) > 1000) || strlen($message) > 2400) && empty($parse_tags))
{
@ -2522,7 +2555,11 @@ function parse_bbc($message, $smileys = true, $cache_id = '', $parse_tags = arra
// For parsed content, we must recurse to avoid security problems.
if ($tag['type'] != 'unparsed_equals')
{
$data = parse_bbc($data, !empty($tag['parsed_tags_allowed']) ? false : true, '', !empty($tag['parsed_tags_allowed']) ? $tag['parsed_tags_allowed'] : array());
// Unfortunately, this is the only way to deal with such a failure of a function...
parse_bbc('sp');
}
$tag['after'] = strtr($tag['after'], array('$1' => $data));
@ -2855,6 +2892,20 @@ function redirectexit($setLocation = '', $refresh = false)
$add = preg_match('~^(ftp|http)[s]?://~', $setLocation) == 0 && substr($setLocation, 0, 6) != 'about:';
// Set the default redirect location as the forum or the portal.
if ((empty($setLocation) || $scripturl == $setLocation) && ($modSettings['sp_portal_mode'] == 1 || $modSettings['sp_portal_mode'] == 3))
{
// Redirect the user to the forum.
if (!empty($modSettings['sp_disableForumRedirect']))
$setLocation = 'action=forum';
// Redirect the user to the SSI.php standalone portal.
elseif ($modSettings['sp_portal_mode'] == 3)
{
$setLocation = $context['portal_url'];
$add = false;
}
}
if (WIRELESS)
{
// Add the scripturl on if needed.
@ -2881,9 +2932,9 @@ function redirectexit($setLocation = '', $refresh = false)
if (!empty($modSettings['queryless_urls']) && (empty($context['server']['is_cgi']) || @ini_get('cgi.fix_pathinfo') == 1 || @get_cfg_var('cgi.fix_pathinfo') == 1) && (!empty($context['server']['is_apache']) || !empty($context['server']['is_lighttpd'])))
{
if (defined('SID') && SID != '')
$setLocation = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', create_function('$m', 'global $scripturl; return $scripturl . \'/\' . strtr("$m[1]", \'&;=\', \'//,\') . \'.html?\' . SID . (isset($m[2]) ? "$m[2]" : "");'), $setLocation);
$setLocation = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic|page)=[^#]+?)(#[^"]*?)?$~', create_function('$m', 'global $scripturl; return $scripturl . \'/\' . strtr("$m[1]", \'&;=\', \'//,\') . \'.html?\' . SID . (isset($m[2]) ? "$m[2]" : "");'), $setLocation);
else
$setLocation = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', create_function('$m', 'global $scripturl; return $scripturl . \'/\' . strtr("$m[1]", \'&;=\', \'//,\') . \'.html\' . (isset($m[2]) ? "$m[2]" : "");'), $setLocation);
$setLocation = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\?((?:board|topic|page)=[^#"]+?)(#[^"]*?)?$~', create_function('$m', 'global $scripturl; return $scripturl . \'/\' . strtr("$m[1]", \'&;=\', \'//,\') . \'.html\' . (isset($m[2]) ? "$m[2]" : "");'), $setLocation);
}
// Maybe integrations want to change where we are heading?
@ -4047,7 +4098,7 @@ function setupMenuContext()
// Set up the menu privileges.
$context['allow_search'] = allowedTo('search_posts');
$context['allow_admin'] = allowedTo(array('admin_forum', 'manage_boards', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_attachments', 'manage_smileys'));
$context['allow_admin'] = allowedTo(array('admin_forum', 'manage_boards', 'sp_admin', 'sp_manage_settings', 'sp_manage_blocks', 'sp_manage_articles', 'sp_manage_pages', 'sp_manage_shoutbox', 'manage_permissions', 'moderate_forum', 'manage_membergroups', 'manage_bans', 'send_mail', 'edit_news', 'manage_attachments', 'manage_smileys'));
$context['allow_edit_profile'] = !$user_info['is_guest'] && allowedTo(array('profile_view_own', 'profile_view_any', 'profile_identity_own', 'profile_identity_any', 'profile_extra_own', 'profile_extra_any', 'profile_remove_own', 'profile_remove_any', 'moderate_forum', 'manage_membergroups', 'profile_title_own', 'profile_title_any'));
$context['allow_memberlist'] = allowedTo('view_mlist');
$context['allow_calendar'] = allowedTo('calendar_view') && !empty($modSettings['cal_enabled']);
@ -4057,17 +4108,24 @@ function setupMenuContext()
$cacheTime = $modSettings['lastActive'] * 60;
// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'] . '-' . empty($context['disable_sp']), $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'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'],
),
'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(
),
),
//xxx show archived boards, commented out for Tom :)
/*
'show_archived' => array(
@ -4301,7 +4359,7 @@ function setupMenuContext()
}
if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $menu_buttons, $cacheTime);
cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'] . '-' . empty($context['disable_sp']), $menu_buttons, $cacheTime);
}
$context['menu_buttons'] = $menu_buttons;
@ -4312,7 +4370,7 @@ function setupMenuContext()
// Figure out which action we are doing so we can set the active tab.
// Default to home.
$current_action = 'home';
$current_action = $modSettings['sp_portal_mode'] == 3 && empty($context['standalone']) && empty($context['disable_sp']) ? 'forum' : 'home';
if (isset($context['menu_buttons'][$context['current_action']]))
$current_action = $context['current_action'];
@ -4320,6 +4378,8 @@ function setupMenuContext()
$current_action = 'search';
elseif ($context['current_action'] == 'theme')
$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', 'recent', 'stats', 'who'))) && in_array($modSettings['sp_portal_mode'], array(1, 3))))
$current_action = 'forum';
elseif ($context['current_action'] == 'register2')
$current_action = 'register';
elseif ($context['current_action'] == 'login2' || ($user_info['is_guest'] && $context['current_action'] == 'reminder'))

View File

@ -276,6 +276,13 @@ function determineActions($urls, $preferred_prefix = false)
return array();
loadLanguage('Who');
global $scripturl;
if ($modSettings['sp_portal_mode'] == 1)
{
$txt['who_index'] = sprintf($txt['sp_who_index'], $scripturl);
$txt['whoall_forum'] = sprintf($txt['sp_who_forum'], $scripturl);
}
// Actions that require a specific permission level.
$allowedActions = array(
'admin' => array('moderate_forum', 'manage_membergroups', 'manage_bans', 'admin_forum', 'manage_permissions', 'send_mail', 'manage_attachments', 'manage_smileys', 'manage_boards', 'edit_news'),
@ -309,6 +316,7 @@ function determineActions($urls, $preferred_prefix = false)
$topic_ids = array();
$profile_ids = array();
$board_ids = array();
$page_ids = array();
$data = array();
foreach ($url_list as $k => $url)
@ -339,6 +347,11 @@ function determineActions($urls, $preferred_prefix = false)
$data[$k] = $txt['who_hidden'];
$board_ids[$actions['board']][$k] = $txt['who_board'];
}
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!
else
$data[$k] = $txt['who_index'];
@ -484,6 +497,64 @@ function determineActions($urls, $preferred_prefix = false)
$smcFunc['db_free_result']($result);
}
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, permission_set, groups_allowed, groups_denied
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['permission_set'], $row['groups_allowed'], $row['groups_denied']))
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']), $scripturl);
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']), $scripturl);
}
}
}
// Load member names for the profile.
if (!empty($profile_ids) && (allowedTo('profile_view_any') || allowedTo('profile_view_own')))
{

View File

@ -170,6 +170,15 @@ function template_main()
// Allow adding new buttons easily.
call_integration_hook('integrate_display_buttons', array(&$normal_buttons));
// Article related buttons...
if (!empty($modSettings['articleactive']))
{
if ($context['can_add_article'] && !$context['topic_is_article'])
$normal_buttons['add_article'] = array('text' => 'sp-add_article', 'image' => 'addarticle.gif', 'lang' => true, 'url' => $scripturl . '?action=portal;sa=addarticle;message=' . $context['topic_first_message'] . ';return=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']);
if ($context['can_remove_article'] && $context['topic_is_article'])
$normal_buttons['remove_article'] = array('text' => 'sp-remove_article', 'image' => 'removearticle.gif', 'lang' => true, 'url' => $scripturl . '?action=portal;sa=removearticle;message=' . $context['topic_first_message'] . ';return=' . $context['current_topic'] . '.' . $context['start'] . ';sesc=' . $context['session_id']);
}
// Show the page index... "Pages: [1]".
echo '
<div class="pagesection">

View File

@ -0,0 +1,246 @@
<?php
// Version: 2.3.5; Portal
function template_portal_above()
{
global $context, $modSettings;
if (empty($modSettings['sp_disable_side_collapse']) && ($context['SPortal']['sides'][1]['active'] || $context['SPortal']['sides'][4]['active']))
{
echo '
<div class="sp_right sp_fullwidth">';
if ($context['SPortal']['sides'][1]['active'])
echo '
<a href="#side" onclick="return sp_collapseSide(1)">', sp_embed_image($context['SPortal']['sides'][1]['collapsed'] ? 'expand' : 'collapse', '', null, null, true, 'sp_collapse_side1'), '</a>';
if ($context['SPortal']['sides'][4]['active'])
echo '
<a href="#side" onclick="return sp_collapseSide(4)">', sp_embed_image($context['SPortal']['sides'][4]['collapsed'] ? 'expand' : 'collapse', '', null, null, true, 'sp_collapse_side4'), '</a>';
echo '
</div>';
}
if (!empty($context['SPortal']['blocks'][5]))
{
echo '
<div id="sp_header">';
foreach ($context['SPortal']['blocks'][5] as $block)
template_block($block);
echo '
</div>';
}
echo '
<table id="sp_main">
<tr>';
if (!empty($modSettings['showleft']) && !empty($context['SPortal']['blocks'][1]))
{
echo '
<td id="sp_left"', !empty($modSettings['leftwidth']) ? ' width="' . $modSettings['leftwidth'] . '"' : '', $context['SPortal']['sides'][1]['collapsed'] && empty($modSettings['sp_disable_side_collapse']) ? ' style="display: none;"' : '', '>';
foreach ($context['SPortal']['blocks'][1] as $block)
template_block($block);
echo '
</td>';
}
echo '
<td id="sp_center">';
if (!empty($context['SPortal']['blocks'][2]))
{
foreach ($context['SPortal']['blocks'][2] as $block)
template_block($block);
if (empty($context['SPortal']['on_portal']))
echo '
<br class="sp_side_clear" />';
}
}
function template_portal_below()
{
global $context, $modSettings;
if (!empty($context['SPortal']['blocks'][3]))
{
if (empty($context['SPortal']['on_portal']) || !empty($context['SPortal']['blocks'][2]) || !empty($modSettings['articleactive']))
echo '
<br class="sp_side_clear" />';
foreach ($context['SPortal']['blocks'][3] as $block)
template_block($block);
}
echo '
</td>';
if (!empty($modSettings['showright']) && !empty($context['SPortal']['blocks'][4]))
{
echo '
<td id="sp_right"', !empty($modSettings['rightwidth']) ? ' width="' . $modSettings['rightwidth'] . '"' : '', $context['SPortal']['sides'][4]['collapsed'] && empty($modSettings['sp_disable_side_collapse']) ? ' style="display: none;"' : '', '>';
foreach ($context['SPortal']['blocks'][4] as $block)
template_block($block);
echo '
</td>';
}
echo '
</tr>
</table>';
if (!empty($context['SPortal']['blocks'][6]))
{
echo '
<div id="sp_footer">';
foreach ($context['SPortal']['blocks'][6] as $block)
template_block($block);
echo '
</div>
<br />';
}
}
function template_block($block)
{
global $context, $modSettings, $txt;
if (empty($block) || empty($block['type']))
return;
if ($block['type'] == 'sp_boardNews')
{
echo '
<div class="sp_block_section', isset($context['SPortal']['sides'][$block['column']]['last']) && $context['SPortal']['sides'][$block['column']]['last'] == $block['id'] && ($block['column'] != 2 || empty($modSettings['articleactive'])) ? '_last' : '', '">';
$block['type']($block['parameters'], $block['id']);
echo '
</div>';
return;
}
if (isset($txt['sp_custom_block_title_' . $block['id']]))
$block['label'] = $txt['sp_custom_block_title_' . $block['id']];
if ($context['SPortal']['core_compat'])
template_block_core($block);
else
template_block_curve($block);
}
function template_block_core($block)
{
global $context, $modSettings, $settings;
echo '
<div class="sp_block_section', isset($context['SPortal']['sides'][$block['column']]['last']) && $context['SPortal']['sides'][$block['column']]['last'] == $block['id'] && ($block['column'] != 2 || empty($modSettings['articleactive'])) ? '_last' : '', '">
<div class="', !empty($block['style']['no_body']) ? '' : ' tborder', '">
<table class="sp_block">';
if (empty($block['style']['no_title']))
{
echo '
<tr>
<td class="sp_block_padding ', $block['style']['title']['class'], '"', !empty($block['style']['title']['style']) ? ' style="' . $block['style']['title']['style'] . '"' : '', '>';
if (empty($block['force_view']))
echo '
<a class="sp_float_right" href="javascript:void(0);" onclick="sp_collapseBlock(\'', $block['id'], '\')"><img id="sp_collapse_', $block['id'], '" src="', $settings['images_url'], $block['collapsed'] ? '/expand.gif' : '/collapse.gif', '" alt="*" /></a>';
echo '
', parse_bbc($block['label']), '
</td>
</tr>';
}
echo '
<tr', (empty($block['force_view']) ? ' id="sp_block_' . $block['id'] . '"' : '') , $block['collapsed'] && empty($block['force_view']) ? ' style="display: none;"' : '', '>
<td class="sp_block_padding', ($block['type'] == 'sp_menu') ? '' : ' sp_block', empty($block['style']['body']['class']) ? '' : ' ' . $block['style']['body']['class'], '"', !empty($block['style']['body']['style']) ? ' style="' . $block['style']['body']['style'] . '"' : '', '>';
$block['type']($block['parameters'], $block['id']);
echo '
</td>
</tr>
</table>
</div>
</div>';
}
function template_block_curve($block)
{
global $context, $modSettings, $settings;
if (empty($block['style']['no_title']))
{
echo '
<div class="', in_array($block['style']['title']['class'], array('titlebg', 'titlebg2')) ? 'title_bar' : 'cat_bar', '"', !empty($block['style']['title']['style']) ? ' style="' . $block['style']['title']['style'] . '"' : '', '>
<h3 class="', $block['style']['title']['class'], '">';
if (empty($block['force_view']))
echo '
<a class="sp_float_right" style="padding-top: 7px;" href="javascript:void(0);" onclick="sp_collapseBlock(\'', $block['id'], '\')"><img id="sp_collapse_', $block['id'], '" src="', $settings['images_url'], $block['collapsed'] ? '/expand.gif' : '/collapse.gif', '" alt="*" /></a>';
echo '
', parse_bbc($block['label']), '
</h3>
</div>';
}
echo '
<div id="sp_block_' . $block['id'] . '" class="sp_block_section', isset($context['SPortal']['sides'][$block['column']]['last']) && $context['SPortal']['sides'][$block['column']]['last'] == $block['id'] && ($block['column'] != 2 || empty($modSettings['articleactive'])) ? '_last' : '', '" ', $block['collapsed'] && empty($block['force_view']) ? ' style="display: none;"' : '', '>';
if (strpos($block['style']['body']['class'], 'roundframe') !== false)
{
echo '
<span class="upperframe"><span></span></span>';
}
echo '
<div', empty($block['style']['body']['class']) ? '' : ' class="' . $block['style']['body']['class'] . '"', '>';
if (empty($block['style']['no_body']))
{
echo '
<span class="topslice"><span></span></span>';
}
echo '
<div class="', $block['type'] != 'sp_menu' ? 'sp_block' : 'sp_content_padding', '"', !empty($block['style']['body']['style']) ? ' style="' . $block['style']['body']['style'] . '"' : '', '>';
$block['type']($block['parameters'], $block['id']);
echo '
</div>';
if (empty($block['style']['no_body']))
{
echo '
<span class="botslice"><span></span></span>';
}
echo '
</div>';
if (strpos($block['style']['body']['class'], 'roundframe') !== false)
{
echo '
<span class="lowerframe"><span></span></span>';
}
echo '
</div>';
}
?>

View File

@ -0,0 +1,313 @@
<?php
// Version: 2.3.5; PortalAdmin
function template_general_settings()
{
global $context, $modSettings, $txt, $settings, $scripturl;
echo '
<div id="admincenter">
<form action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
if (isset($context['settings_title']))
echo '
<div class="cat_bar">
<h3 class="catbg">
', $context['settings_title'], '
</h3>
</div>';
if (!empty($context['settings_message']))
echo '
<div class="information">', $context['settings_message'], '</div>';
$is_open = false;
foreach ($context['config_vars'] as $config_var)
{
if (is_array($config_var) && ($config_var['type'] == 'title' || $config_var['type'] == 'desc'))
{
if ($is_open)
{
$is_open = false;
echo '
</dl>
</div>
<span class="botslice"><span></span></span>
</div>';
}
if ($config_var['type'] == 'title')
{
echo '
<div class="cat_bar">
<h3 class="', !empty($config_var['class']) ? $config_var['class'] : 'catbg', '"', !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>
', ($config_var['help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $config_var['help'] . '" onclick="return reqWin(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.gif" alt="' . $txt['help'] . '" /></a>' : ''), '
', $config_var['label'], '
</h3>
</div>';
}
else
{
echo '
<p class="description">
', $config_var['label'], '
</p>';
}
continue;
}
if (!$is_open)
{
$is_open = true;
echo '
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="content">
<dl class="settings">';
}
if (is_array($config_var))
{
if (in_array($config_var['type'], array('message', 'warning')))
{
echo '
<dd', $config_var['type'] == 'warning' ? ' class="alert"' : '', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>
', $config_var['label'], '
</dd>';
}
else
{
echo '
<dt', is_array($config_var) && !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>';
$javascript = $config_var['javascript'];
$disabled = !empty($config_var['disabled']) ? ' disabled="disabled"' : '';
$subtext = !empty($config_var['subtext']) ? '<br /><span class="smalltext"> ' . $config_var['subtext'] . '</span>' : '';
if ($config_var['help'])
echo '
<a id="setting_', $config_var['name'], '" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" border="0" /></a><span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br /><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
</dt>';
else
echo '
<a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br /><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
</dt>';
echo '
<dd', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>',
$config_var['preinput'];
if ($config_var['type'] == 'check')
echo '
<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked="checked"' : ''), ' value="1" class="input_check" />';
elseif ($config_var['type'] == 'select')
{
echo '
<select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), '>';
foreach ($config_var['data'] as $option)
echo '
<option value="', $option[0], '"', (($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected="selected"' : ''), '>', $option[1], '</option>';
echo '
</select>';
}
elseif ($config_var['type'] == 'large_text')
{
echo '
<textarea rows="', ($config_var['size'] ? $config_var['size'] : 4), '" cols="30" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
}
elseif ($config_var['type'] == 'var_message')
echo $config_var['var_message'];
elseif ($config_var['type'] == 'multicheck')
{
foreach($config_var['subsettings'] as $name => $title)
{
echo '
<input type="hidden" name="', $name, '" value="0" /><input type="checkbox" name="', $name, '" id="', $name, '" ', (!empty($modSettings[$name]) ? ' checked="checked"' : ''), ' class="input_check" />
', $title, '<br />';
}
}
else
echo '
<input type="text"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '" value="', $config_var['value'], '"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_text" />';
echo '
', $config_var['postinput'], '
</dd>';
}
}
else
{
if ($config_var == '')
echo '
</dl>
<hr class="hrcolor" />
<dl class="settings">';
else
echo '
<strong>' . $config_var . '</strong>';
}
}
if ($is_open)
echo '
</dl>';
if (empty($context['settings_save_dont_show']))
echo '
<p>
<input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled="disabled"' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit" />
</p>';
if ($is_open)
echo '
</div>
<span class="botslice"><span></span></span>
</div>';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>
<br class="clear" />';
}
function template_information()
{
global $context, $txt;
if ($context['in_admin'])
{
echo '
<div id="sp_admin_main">
<div id="sp_live_info" class="sp_float_left">
<div class="cat_bar">
<h3 class="catbg">
', $txt['sp-info_live'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<div id="spAnnouncements" style="">', $txt['sp-info_no_live'], '</div>
</div>
<span class="botslice"><span></span></span>
</div>
</div>
<div id="sp_general_info" class="sp_float_right">
<div class="cat_bar">
<h3 class="catbg">
', $txt['sp-info_general'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<strong>', $txt['sp-info_versions'], ':</strong><br />
', $txt['sp-info_your_version'], ':
<em id="spYourVersion" style="white-space: nowrap;">', $context['sp_version'], '</em><br />
', $txt['sp-info_current_version'], ':
<em id="spCurrentVersion" style="white-space: nowrap;">??</em><br />
<strong>', $txt['sp-info_managers'], ':</strong>
', implode(', ', $context['sp_managers']), '
</div>
<span class="botslice"><span></span></span>
</div>
</div>
</div>
<script language="JavaScript" type="text/javascript" src="http://www.simpleportal.net/sp/current-version.js"></script>
<script language="JavaScript" type="text/javascript" src="http://www.simpleportal.net/sp/latest-news.js"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
function spSetAnnouncements()
{
if (typeof(window.spAnnouncements) == "undefined" || typeof(window.spAnnouncements.length) == "undefined")
return;
var str = "<div style=\"margin: 4px; font-size: 0.85em;\">";
for (var i = 0; i < window.spAnnouncements.length; i++)
{
str += "\n <div style=\"padding-bottom: 2px;\"><a hre" + "f=\"" + window.spAnnouncements[i].href + "\">" + window.spAnnouncements[i].subject + "<" + "/a> ', $txt['on'], ' " + window.spAnnouncements[i].time + "<" + "/div>";
str += "\n <div style=\"padding-left: 2ex; margin-bottom: 1.5ex; border-top: 1px dashed;\">"
str += "\n " + window.spAnnouncements[i].message;
str += "\n <" + "/div>";
}
setInnerHTML(document.getElementById("spAnnouncements"), str + "<" + "/div>");
}
function spCurrentVersion()
{
var spVer, yourVer;
if (typeof(window.spVersion) != "string")
return;
spVer = document.getElementById("spCurrentVersion");
yourVer = document.getElementById("spYourVersion");
setInnerHTML(spVer, window.spVersion);
var currentVersion = getInnerHTML(yourVer);
if (currentVersion != window.spVersion)
setInnerHTML(yourVer, "<span class=\"alert\">" + currentVersion + "<" + "/span>");
}';
echo '
var func = function ()
{
spSetAnnouncements();
spCurrentVersion();
}
', $context['SPortal']['core_compat'] == 'old' ? 'add_load_event(func);' : 'addLoadEvent(func);','
// ]]></script>';
}
echo '
<div class="cat_bar">
<h3 class="catbg">
', $txt['sp-info_title'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding" id="sp_credits">';
foreach ($context['sp_credits'] as $section)
{
if (isset($section['pretext']))
echo '
<p>', $section['pretext'], '</p>';
foreach ($section['groups'] as $group)
{
if (empty($group['members']))
continue;
echo '
<p>';
if (isset($group['title']))
echo '
<strong>', $group['title'], ':</strong> ';
echo implode(', ', $group['members']), '
</p>';
}
if (isset($section['posttext']))
echo '
<p>', $section['posttext'], '</p>';
}
echo '
<hr />
<p>', sprintf($txt['sp-info_contribute'], 'http://www.simpleportal.net/index.php?page=contribute'), '</p>
</div>
<span class="botslice"><span></span></span>
</div>';
}
?>

View File

@ -0,0 +1,405 @@
<?php
// Version: 2.3.5; PortalAdminArticles
function template_article_list()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="sp_manage_articles">
<form action="', $scripturl, '?action=admin;area=portalarticles;sa=articles" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['sp-articlesConfirm'], '\');">
<div class="sp_align_left pagesection">
', $txt['pages'], ': ', $context['page_index'], '
</div>
<table class="table_grid" cellspacing="0" width="100%">
<thead>
<tr class="catbg">';
foreach ($context['columns'] as $column)
{
if ($column['selected'])
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
<a href="', $column['href'], '">', $column['label'], '&nbsp;<img src="', $settings['images_url'], '/sort_', $context['sort_direction'], '.gif" alt="" /></a>
</th>';
elseif ($column['sortable'])
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
', $column['link'], '
</th>';
else
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
', $column['label'], '
</th>';
}
echo '
<th scope="col" class="last_th">
<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />
</th>
</tr>
</thead>
<tbody>';
if (empty($context['total_articles']))
{
echo '
<tr class="windowbg2">
<td class="sp_center" colspan="', count($context['columns']) + 1, '">&nbsp;</td>
</tr>';
}
while ($article = $context['get_article']())
{
echo '
<tr class="windowbg2">
<td class="sp_left">', $article['topic']['link'], '</td>
<td class="sp_left">', $article['board']['link'], '</td>
<td class="sp_center">', $article['poster']['link'], '</td>
<td class="sp_center">', $article['message']['time'], '</td>
<td class="sp_left">', $article['category']['name'], '</td>
<td class="sp_center"><a href="', $scripturl, '?action=admin;area=portalarticles;sa=statechange;article_id=', $article['article']['id'], ';type=article;', $context['session_var'], '=', $context['session_id'], '">', empty($article['article']['approved']) ? sp_embed_image('deactive', $txt['sp-stateNo']) : sp_embed_image('active', $txt['sp-stateYes']), '</a></td>
<td class="sp_center">', $article['edit'], ' ', $article['delete'], '</td>
<td class="sp_center"><input type="checkbox" name="remove[]" value="', $article['article']['id'], '" class="input_check" /></td>
</tr>';
}
echo '
</tbody>
</table>
<div class="sp_align_left pagesection">
<div class="sp_float_right">
<input type="submit" name="removeArticles" value="', $txt['sp-articlesRemove'], '" class="button_submit" />
</div>
', $txt['pages'], ': ', $context['page_index'], '
</div>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
function template_article_add()
{
global $context, $settings, $options, $txt, $scripturl;
echo '
<div id="sp_article_add">
<form action="' . $scripturl . '?action=admin;area=portalarticles;sa=addarticle;targetboard=' . $context['target_board'] . '" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-articlesAdd" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>&nbsp;
', $txt['sp-articlesAdd'], '
</h3>
</div>
<div id="sp_add_articles_category" class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<dl class="sp_form">
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp-articlesCategory" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="category">', $txt['sp-articlesCategory'], ':</label>
</dt>
<dd>
<select id="category" name="category">';
foreach($context['list_categories'] as $category)
echo '
<option value="', $category['id'], '">', $category['name'], '</option>';
echo '
</select>
</dd>
</dl>
</div>
<span class="botslice"><span></span></span>
</div>
<div class="sp_align_left pagesection">
', $txt['pages'], ': ', $context['page_index'], '
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">';
if (!empty($context['boards']) && count($context['boards']) > 1)
{
echo '
<dl class="sp_form">
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp-articlesBoards" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="targetboard">', $txt['board'], ':</label>
</dt>
<dd>
<select name="targetboard" id="targetboard" onchange="this.form.submit();">';
foreach ($context['boards'] as $board)
echo '
<option value="', $board['id'], '"', $board['id'] == $context['target_board'] ? ' selected="selected"' : '', '>', $board['category'], ' - ', $board['name'], '</option>';
echo '
</select><noscript>
<input type="submit" value="', $txt['sp-articlesAdd'], '" class="button_submit" /></noscript>
</dd>
</dl>';
}
echo '
<div id="sp_add_articles_list_header">
<a href="', $scripturl, '?action=helpadmin;help=sp-articlesTopics" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $txt['topics'], ':';
if (!empty($context['topics']))
{
echo '
</div>
<ul id="sp_add_articles_list">';
foreach ($context['topics'] as $topic)
echo '
<li>
<input type="checkbox" name="articles[]" value="', $topic['msg_id'], '" class="input_check" />
<a href="' . $scripturl . '?topic=' . $topic['id'] . '.0" target="_blank">' . $topic['subject'] . '</a> ' . $txt['started_by'] . ' ' . $topic['poster']['link'] . '
</li>';
echo '
</ul>
<div id="sp_add_articles_button" class="sp_button_container">
<input type="submit" name="createArticle" value="', $txt['sp-articlesAdd'], '" class="button_submit" />
</div>';
}
else
echo '
', $txt['sp-adminArticleAddNoTopics'], '
</div>';
echo '
</div>
<span class="botslice"><span></span></span>
</div>
<div class="sp_align_left pagesection">
', $txt['pages'], ': ', $context['page_index'], '
</div>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
function template_article_edit()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="sp_edit_category">
<form action="', $scripturl, '?action=admin;area=portalarticles;sa=editarticle" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-articlesEdit" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $txt['sp-articlesEdit'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<dl class="sp_form">
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp-articlesCategory" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="category">', $txt['sp-articlesCategory'], ':</label>
</dt>
<dd>
<select id="category" name="category">';
foreach($context['list_categories'] as $category)
echo '
<option value="' . $category['id'] . '"' . ($context['article_info']['category']['id'] == $category['id'] ? ' selected="selected"' : '') . ' >' . $category['name'] . '</option>';
echo '
</select>
</dd>
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp-articlesApproved" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="approved">', $txt['sp-articlesApproved'], ':</label>
</dt>
<dd>
<input type="checkbox" name="approved" value="1" id="approved"', !empty($context['article_info']['article']['approved']) ? ' checked="checked"' : '', ' class="input_check" />
</dd>
</dl>
<div class="sp_button_container">
<input type="submit" name="add_article" value="', $txt['sp-articlesEdit'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<input type="hidden" name="article_id" value="', $context['article_info']['article']['id'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
function template_category_list()
{
global $context, $settings, $options, $scripturl, $txt;
echo '
<table class="table_grid" cellspacing="0" width="100%">
<thead>
<tr class="catbg">';
foreach ($context['columns'] as $column)
{
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
', $column['label'], '
</th>';
}
echo '
</tr>
</thead>
<tbody>';
if (empty($context['categories']))
{
echo '
<tr class="windowbg2">
<td class="sp_center" colspan="', count($context['columns']) + 1, '">&nbsp;</td>
</tr>';
}
foreach($context['categories'] as $category)
{
echo '
<tr class="windowbg2">
<td class="sp_center">', !empty($category['picture']['href']) ? $category['picture']['image'] : '', '</td>
<td class="sp_left">', $category['name'], '</td>
<td class="sp_center">', $category['articles'], '</td>
<td class="sp_center"><a href="', $scripturl, '?action=admin;area=portalarticles;sa=statechange;category_id=', $category['id'], ';type=category;', $context['session_var'], '=', $context['session_id'], '">', empty($category['publish']) ? sp_embed_image('deactive', $txt['sp-stateNo']) : sp_embed_image('active', $txt['sp-stateYes']), '</a></td>
<td class="sp_center"><a href="', $scripturl, '?action=admin;area=portalarticles;sa=editcategory;category_id=', $category['id'], ';', $context['session_var'], '=', $context['session_id'], '">', sp_embed_image('modify'), '</a> <a href="', $scripturl, '?action=admin;area=portalarticles;sa=deletecategory;category_id=', $category['id'], ';', $context['session_var'], '=', $context['session_id'], '"', (empty($category['articles']) ? ' onclick="return confirm(\'' . $txt['sp-categoriesDeleteConfirm'] . '\');"' : ''), '>', sp_embed_image('delete'), '</a></td>
</tr>';
}
echo '
</tbody>
</table>';
}
function template_category_edit()
{
global $context, $settings, $scripturl, $txt, $modSettings;
echo '
<div id="sp_edit_category">
<form action="', $scripturl, '?action=admin;area=portalarticles;sa=', $context['category_action'], 'category" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-categories', ucfirst($context['category_action']), '" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $context['page_title'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<dl class="sp_form">
<dt>
<label for="category_name">', $txt['sp-categoriesName'], ':</label>
</dt>
<dd>
<input type="text" name="category_name" id="category_name" value="', !empty($context['category_info']['name']) ? $context['category_info']['name'] : '', '" size="20" class="input_text"/>
</dd>
<dt>
<label for="category_picture">', $txt['sp-categoriesPicture'], ':</label>
</dt>
<dd>
<input type="text" name="picture_url" id="category_picture" value="', !empty($context['category_info']['picture']['href']) ? $context['category_info']['picture']['href'] : '', '" size="30" class="input_text"/>
</dd>
<dt>
<label for="category_publish">', $txt['sp-categoriesPublish'], ':</label>
</dt>
<dd>
<input type="checkbox" name="show_on_index" id="category_publish" value="1"', !empty($context['category_info']['publish']) || $context['category_action'] == 'add' ? ' checked="checked"' : '', ' class="input_check"/>
</dd>
</dl>
<div class="sp_button_container">
<input type="submit" name="submit" value="', $context['page_title'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="edit_category" value="1" />';
if ($context['category_action'] == 'edit')
echo '
<input type="hidden" name="category_id" value="', $context['category_info']['id'], '" />';
echo '
</form>
</div>';
}
function template_category_delete()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="sp_edit_category">
<form action="', $scripturl, '?action=admin;area=portalarticles;sa=deletecategory" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-categoriesDelete" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $txt['sp-categoriesDelete'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<div class="sp_center">
', sprintf($txt['sp-categoriesDeleteCount'], $context['category_info']['articles']), '<br />';
if (!empty($context['list_categories']))
{
echo '
', $txt['sp-categoriesDeleteOption1'], '
</div>
<dl class="sp_form">
<dt>
<label for="category_move">', $txt['sp-categoriesMove'], ':</label>
</dt>
<dd>
<input type="checkbox" name="category_move" value="1" id="category_move" checked="checked" class="input_check" />
</dd>
<dt>
<label for="category_move_to">', $txt['sp-categoriesMoveTo'], ':</label>
</dt>
<dd>
<select id="category_move_to" name="category_move_to">';
foreach($context['list_categories'] as $category)
{
if ($category['id'] != $context['category_info']['id'])
echo '
<option value="', $category['id'], '">', $category['name'], '</option>';
}
echo '
</select>
</dd>
</dl>';
}
else
{
echo '
', $txt['sp-categoriesDeleteOption2'], '
</div>';
}
echo '
<div class="sp_button_container">
<input type="submit" name="delete_category" value="', $txt['sp-categoriesDelete'], '" onclick="return confirm(\'' . $txt['sp-categoriesDeleteConfirm'] . '\');" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<input type="hidden" name="category_id" value="', $context['category_info']['id'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
?>

View File

@ -0,0 +1,569 @@
<?php
// Version: 2.3.5; PortalAdminBlocks
function template_block_list()
{
global $context, $settings, $options, $scripturl, $txt;
echo '
<div id="sp_manage_blocks">';
if ($context['block_move'])
echo '
<div class="information">
<p>', $context['move_title'], ' [<a href="', $scripturl, '?action=admin;area=portalblocks">', $txt['sp-blocks_cancel_moving'], '</a>]', '</p>
</div>';
foreach($context['sides'] as $id => $side)
{
echo '
<div class="cat_bar">
<h3 class="catbg">
<a class="sp_float_right" href="', $scripturl, '?action=admin;area=portalblocks;sa=add;col=', $side['id'], '">', sp_embed_image('add', sprintf($txt['sp-blocksCreate'], $side['label'])), '</a>
<a href="', $scripturl, '?action=helpadmin;help=', $side['help'], '" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<a href="', $scripturl, '?action=admin;area=portalblocks;sa=', $id, '">', $side['label'], ' ', $txt['sp-blocksBlocks'], '</a>
</h3>
</div>
<table class="table_grid" cellspacing="0" width="100%">
<thead>
<tr class="catbg">';
if ($context['block_move'])
echo '
<th scope="col" class="first_th" width="5%">', $txt['sp-adminColumnMove'], '</th>';
foreach ($context['columns'] as $column)
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>', $column['label'], '</th>';
echo '
</tr>
</thead>
<tbody>';
if (empty($context['blocks'][$side['name']]))
{
echo '
<tr class="windowbg2">
<td class="sp_center" colspan="4">', $txt['error_sp_no_block'], '</td>
</tr>';
}
foreach($context['blocks'][$side['name']] as $block)
{
echo '
<tr class="windowbg2">';
if ($context['block_move'])
echo '
<td class="sp_center">', $block['id'] != $context['block_move'] ? $block['move_insert'] : '', '</td>';
echo '
<td>', $block['id'] == $context['block_move'] ? '<strong>' . $block['label'] . '</strong>' : $block['label'], '</td>
<td>', $block['type_text'], '</td>
<td class="sp_center">', implode(' ', $block['actions']), '</td>
</tr>';
}
if ($context['block_move'] && (empty($side['last']) || $context['block_move'] != $side['last']))
{
echo '
<tr class="windowbg2">
<td class="sp_center"><a href="', $scripturl, '?action=admin;area=portalblocks;sa=move;block_id=', $context['block_move'], ';col=', $side['id'], ';', $context['session_var'], '=', $context['session_id'], '">', sp_embed_image('arrow', $txt['sp-blocks_move_here']), '</a></td>
<td></td>
<td></td>
<td></td>
</tr>';
}
echo '
</tbody>
</table>';
}
echo '
</div>';
}
function template_block_edit()
{
global $context, $settings, $options, $scripturl, $txt, $helptxt, $modSettings;
if (!empty($context['SPortal']['preview']))
{
echo '
<div class="sp_auto_align" style="width: ', $context['widths'][$context['SPortal']['block']['column']], ';">';
template_block($context['SPortal']['block']);
echo '
</div>';
}
echo '
<div id="sp_edit_block">
<form name="sp_edit_block_form" id="sp_edit_block_form" action="', $scripturl, '?action=admin;area=portalblocks;sa=edit" method="post" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-blocks', $context['SPortal']['is_new'] ? 'Add' : 'Edit', '" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $context['SPortal']['is_new'] ? $txt['sp-blocksAdd'] : $txt['sp-blocksEdit'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<dl class="sp_form">
<dt>
', $txt['sp-adminColumnType'], ':
</dt>
<dd>
', $context['SPortal']['block']['type_text'], '
</dd>
<dt>
<label for="block_name">', $txt['sp-adminColumnName'], ':</label>
</dt>
<dd>
<input type="text" name="block_name" id="block_name" value="', $context['SPortal']['block']['label'], '" size="30" class="input_text" />
</dd>
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp_permissions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $txt['sp_admin_blocks_col_permissions'], ':
</dt>
<dd>
<select name="permission_set" id="block_permission_set" onchange="sp_update_permissions();">';
$permission_sets = array(1 => 'guests', 2 => 'members', 3 => 'everyone', 0 => 'custom');
foreach ($permission_sets as $id => $label)
echo '
<option value="', $id, '"', $id == $context['SPortal']['block']['permission_set'] ? ' selected="selected"' : '', '>', $txt['sp_admin_blocks_permissions_set_' . $label], '</option>';
echo '
</select>
</dd>
<dt id="block_custom_permissions_label">
', $txt['sp_admin_blocks_col_custom_permissions'], ':
</dt>
<dd id="block_custom_permissions_input">
<table>
<tr>
<th>', $txt['sp_admin_blocks_custom_permissions_membergroup'], '</td>
<th title="', $txt['sp_admin_blocks_custom_permissions_allowed'], '">', $txt['sp_admin_blocks_custom_permissions_allowed_short'], '</th>
<th title="', $txt['sp_admin_blocks_custom_permissions_disallowed'], '">', $txt['sp_admin_blocks_custom_permissions_disallowed_short'], '</th>
<th title="', $txt['sp_admin_blocks_custom_permissions_denied'], '">', $txt['sp_admin_blocks_custom_permissions_denied_short'], '</th>
</tr>';
foreach ($context['SPortal']['block']['groups'] as $id => $label)
{
$current = 0;
if (in_array($id, $context['SPortal']['block']['groups_allowed']))
$current = 1;
elseif (in_array($id, $context['SPortal']['block']['groups_denied']))
$current = -1;
echo '
<tr>
<td>', $label, '</td>
<td><input type="radio" name="membergroups[', $id, ']" value="1"', $current == 1 ? ' checked="checked"' : '', ' class="input_radio"></td>
<td><input type="radio" name="membergroups[', $id, ']" value="0"', $current == 0 ? ' checked="checked"' : '', ' class="input_radio"></td>
<td><input type="radio" name="membergroups[', $id, ']" value="-1"', $current == -1 ? ' checked="checked"' : '', ' class="input_radio"></td>
</tr>';
}
echo '
</table>
</dd>';
foreach ($context['SPortal']['block']['options'] as $name => $type)
{
if (empty($context['SPortal']['block']['parameters'][$name]))
$context['SPortal']['block']['parameters'][$name] = '';
echo '
<dt>';
if (!empty($helptxt['sp_param_' . $context['SPortal']['block']['type'] . '_' . $name]))
echo '
<a href="', $scripturl, '?action=helpadmin;help=sp_param_', $context['SPortal']['block']['type'] , '_' , $name, '" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>';
echo '
<label for="', $type == 'bbc' ? 'bbc_content' : $name, '">', $txt['sp_param_' . $context['SPortal']['block']['type'] . '_' . $name], ':</label>
</dt>
<dd>';
if ($type == 'bbc')
{
echo '
</dd>
</dl>
<div id="sp_rich_editor">
<div id="sp_rich_bbc"></div>
<div id="sp_rich_smileys"></div>
', template_control_richedit($context['SPortal']['bbc'], 'sp_rich_smileys', 'sp_rich_bbc'), '
<input type="hidden" name="bbc_name" value="', $name, '" />
<input type="hidden" name="bbc_parameter" value="', $context['SPortal']['bbc'], '" />
</div>
<dl class="sp_form">';
}
elseif ($type == 'boards' || $type == 'board_select')
{
echo '
<input type="hidden" name="parameters[', $name, ']" value="" />';
if ($type == 'boards')
echo '
<select name="parameters[', $name, '][]" id="', $name, '" size="7" multiple="multiple">';
else
echo '
<select name="parameters[', $name, '][]" id="', $name, '">';
foreach ($context['SPortal']['block']['board_options'][$name] as $option)
echo '
<option value="', $option['value'], '"', ($option['selected'] ? ' selected="selected"' : ''), ' >', $option['text'], '</option>';
echo '
</select>';
}
elseif ($type == 'int')
echo '
<input type="text" name="parameters[', $name, ']" id="', $name, '" value="', $context['SPortal']['block']['parameters'][$name],'" size="7" class="input_text" />';
elseif ($type == 'text')
echo '
<input type="text" name="parameters[', $name, ']" id="', $name, '" value="', $context['SPortal']['block']['parameters'][$name],'" size="25" class="input_text" />';
elseif ($type == 'check')
echo '
<input type="checkbox" name="parameters[', $name, ']" id="', $name, '"', !empty($context['SPortal']['block']['parameters'][$name]) ? ' checked="checked"' : '', ' class="input_check" />';
elseif ($type == 'select')
{
$options = explode('|', $txt['sp_param_' . $context['SPortal']['block']['type'] . '_' . $name . '_options']);
echo '
<select name="parameters[', $name, ']" id="', $name, '">';
foreach ($options as $key => $option)
echo '
<option value="', $key, '"', $context['SPortal']['block']['parameters'][$name] == $key ? ' selected="selected"' : '', '>', $option, '</option>';
echo '
</select>';
}
elseif (is_array($type))
{
echo '
<select name="parameters[', $name, ']" id="', $name, '">';
foreach ($type as $key => $option)
echo '
<option value="', $key, '"', $context['SPortal']['block']['parameters'][$name] == $key ? ' selected="selected"' : '', '>', $option, '</option>';
echo '
</select>';
}
elseif ($type == 'textarea')
{
echo '
</dd>
</dl>
<div id="sp_text_editor">
<textarea name="parameters[', $name, ']" id="', $name, '" cols="45" rows="10">', $context['SPortal']['block']['parameters'][$name], '</textarea>
<input type="button" class="button_submit" value="-" onclick="document.getElementById(\'', $name, '\').rows -= 10" />
<input type="button" class="button_submit" value="+" onclick="document.getElementById(\'', $name, '\').rows += 10" />
</div>
<dl class="sp_form">';
}
if ($type != 'bbc')
echo '
</dd>';
}
if (empty($context['SPortal']['block']['column']))
{
echo '
<dt>
<label for="block_column">', $txt['sp-blocksColumn'], ':</label>
</dt>
<dd>
<select id="block_column" name="block_column">';
$block_sides = array(5 => 'Header', 1 => 'Left', 2 => 'Top', 3 => 'Bottom', 4 => 'Right', 6 => 'Footer');
foreach ($block_sides as $id => $side)
echo '
<option value="', $id, '">', $txt['sp-position' . $side], '</option>';
echo '
</select>
</dd>';
}
if (count($context['SPortal']['block']['list_blocks']) > 1)
{
echo '
<dt>
', $txt['sp-blocksRow'], ':
</dt>
<dd>
<select id="order" name="placement"', !$context['SPortal']['is_new'] ? ' onchange="this.form.block_row.disabled = this.options[this.selectedIndex].value == \'\';"' : '', '>
', !$context['SPortal']['is_new'] ? '<option value="nochange">' . $txt['sp-placementUnchanged'] . '</option>' : '', '
<option value="before">', $txt['sp-placementBefore'], '...</option>
<option value="after">', $txt['sp-placementAfter'], '...</option>
</select>
<select id="block_row" name="block_row"', !$context['SPortal']['is_new'] ? ' disabled="disabled"' : '', '>';
foreach ($context['SPortal']['block']['list_blocks'] as $block)
{
if ($block['id'] != $context['SPortal']['block']['id'])
echo '
<option value="', $block['row'], '">', $block['label'], '</option>';
}
echo '
</select>
</dd>';
}
if ($context['SPortal']['block']['type'] != 'sp_boardNews')
{
echo '
<dt>
<label for="block_force">', $txt['sp-blocksForce'], ':</label>
</dt>
<dd>
<input type="checkbox" name="block_force" id="block_force" value="1"', $context['SPortal']['block']['force_view'] ? ' checked="checked"' : '', ' class="input_check" />
</dd>';
}
echo '
<dt>
<label for="block_active">', $txt['sp-blocksActive'], ':</label>
</dt>
<dd>
<input type="checkbox" name="block_active" id="block_active" value="1"', $context['SPortal']['block']['state'] ? ' checked="checked"' : '', ' class="input_check" />
</dd>
</dl>
<div class="sp_button_container">
<input type="submit" name="preview_block" value="', $txt['sp-blocksPreview'], '" class="button_submit" /> <input type="submit" name="add_block" value="', !$context['SPortal']['is_new'] ? $txt['sp-blocksEdit'] : $txt['sp-blocksAdd'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>';
if (!empty($context['SPortal']['block']['column']))
echo '
<input type="hidden" name="block_column" value="', $context['SPortal']['block']['column'], '" />';
echo '
<input type="hidden" name="block_type" value="', $context['SPortal']['block']['type'], '" />
<input type="hidden" name="block_id" value="', $context['SPortal']['block']['id'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />';
if (!empty($modSettings['sp_enableIntegration']))
{
echo '
<br />
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-blocksDisplayOptions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $txt['sp-blocksDisplayOptions'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<span class="sp_float_right">', $txt['sp-blocksAdvancedOptions'], '<input type="checkbox" name="display_advanced" id="display_advanced" onclick="document.getElementById(\'sp_display_advanced\').style.display = this.checked ? \'block\' : \'none\'; document.getElementById(\'display_simple\').disabled = this.checked;" ', empty($context['SPortal']['block']['display_type']) ? '' : ' checked="checked"', ' class="input_check" /></span>
', $txt['sp-blocksShowBlock'], '
<select name="display_simple" id="display_simple"', empty($context['SPortal']['block']['display_type']) ? '' : ' disabled="disabled"', '>';
foreach ($context['simple_actions'] as $action => $label)
echo '
<option value="', $action, '"', in_array($action, $context['SPortal']['block']['display']) ? ' selected="selected"' : '', '>', $label, '</option>';
echo '
</select>
<div id="sp_display_advanced"', empty($context['SPortal']['block']['display_type']) ? ' style="display: none;"' : '', '>';
$display_types = array('actions', 'boards', 'pages');
foreach ($display_types as $type)
{
if (empty($context['display_' . $type]))
continue;
echo '
<a href="javascript:void(0);" onclick="sp_collapseObject(\'', $type, '\')"><img id="sp_collapse_', $type, '" src="', $settings['images_url'], '/expand.gif" alt="*" /></a> ', $txt['sp-blocksSelect' . ucfirst($type)], '
<ul id="sp_object_', $type, '" class="reset sp_display_list" style="display: none;">';
foreach ($context['display_' . $type] as $index => $action)
{
echo '
<li><input type="checkbox" name="display_', $type, '[]" id="', $type, $index, '" value="', $index, '"', in_array($index, $context['SPortal']['block']['display']) ? ' checked="checked"' : '', ' class="input_check" /> <label for="', $type, $index, '">', $action, '</label></li>';
}
echo '
<li><input type="checkbox" onclick="invertAll(this, this.form, \'display_', $type, '[]\');" class="input_check" /> <em>', $txt['check_all'], '</em></li>
</ul>
<br />';
}
echo '
<a href="', $scripturl, '?action=helpadmin;help=sp-blocksCustomDisplayOptions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a> <label for="display_custom">', $txt['sp_display_custom'], ':</label> <input type="text" name="display_custom" id="display_custom" value="', $context['SPortal']['block']['display_custom'], '" class="input_text" />
</div>
<div class="sp_button_container">
<input type="submit" name="add_block" value="', !$context['SPortal']['is_new'] ? $txt['sp-blocksEdit'] : $txt['sp-blocksAdd'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>';
}
$style_sections = array('title' => 'left', 'body' => 'right');
$style_types = array('default' => 'DefaultClass', 'class' => 'CustomClass', 'style' => 'CustomStyle');
$style_parameters = array(
'title' => array('catbg', 'catbg2', 'catbg3', 'titlebg', 'titlebg2'),
'body' => array('windowbg', 'windowbg2', 'windowbg3', 'information', 'roundframe'),
);
if ($context['SPortal']['block']['type'] != 'sp_boardNews')
{
echo '
<br />
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-blocksStyleOptions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $txt['sp-blocksStyleOptions'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">';
foreach ($style_sections as $section => $float)
{
echo '
<dl id="sp_edit_style_', $section, '" class="sp_form sp_float_', $float, '">';
foreach ($style_types as $type => $label)
{
echo '
<dt>
', $txt['sp-blocks' . ucfirst($section) . $label], ':
</dt>
<dd>';
if ($type == 'default')
{
echo '
<select name="', $section, '_default_class" id="', $section, '_default_class">';
foreach ($style_parameters[$section] as $class)
echo '
<option value="', $class, '"', $context['SPortal']['block']['style'][$section . '_default_class'] == $class ? ' selected="selected"' : '', '>', $class, '</option>';
echo '
</select>';
}
else
echo '
<input type="text" name="', $section, '_custom_', $type, '" id="', $section, '_custom_', $type, '" value="', $context['SPortal']['block']['style'][$section . '_custom_' . $type], '" class="input_text" />';
echo '
</dd>';
}
echo '
<dt>
', $txt['sp-blocksNo' . ucfirst($section)], ':
</dt>
<dd>
<input type="checkbox" name="no_', $section, '" id="no_', $section, '" value="1"', !empty($context['SPortal']['block']['style']['no_' . $section]) ? ' checked="checked"' : '', ' onclick="document.getElementById(\'', $section, '_default_class\').disabled', $section == 'title' ? ' = document.getElementById(\'title_custom_class\').disabled = document.getElementById(\'title_custom_style\').disabled' : '', ' = this.checked;" class="input_check" />
</dd>
</dl>';
}
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
document.getElementById("title_default_class").disabled = document.getElementById("no_title").checked;
document.getElementById("title_custom_class").disabled = document.getElementById("no_title").checked;
document.getElementById("title_custom_style").disabled = document.getElementById("no_title").checked;
document.getElementById("body_default_class").disabled = document.getElementById("no_body").checked;
// ]]></script>
<div class="sp_button_container">
<input type="submit" name="add_block" value="', !$context['SPortal']['is_new'] ? $txt['sp-blocksEdit'] : $txt['sp-blocksAdd'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>';
}
echo '
</form>
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
sp_update_permissions();
function sp_update_permissions()
{
var new_state = document.getElementById("block_permission_set").value;
document.getElementById("block_custom_permissions_label").style.display = new_state != 0 ? "none" : "";
document.getElementById("block_custom_permissions_input").style.display = new_state != 0 ? "none" : "";
}
// ]]></script>';
}
function template_block_select_type()
{
global $context, $scripturl, $settings, $txt;
echo '
<div id="sp_select_block_type">
<div class="cat_bar">
<h3 class="catbg">
<a href="', $scripturl, '?action=helpadmin;help=sp-blocksSelectType" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
', $txt['sp-blocksSelectType'], '
</h3>
</div>
<form action="', $scripturl, '?action=admin;area=portalblocks;sa=add" method="post" accept-charset="', $context['character_set'], '">
<table>
<tr>';
foreach($context['SPortal']['block_types'] as $index => $type)
{
if ($index != 0 && $index % 3 == 0)
{
echo '
</tr>
<tr>';
}
echo '
<td>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<input type="radio" name="selected_type[]" id="block_', $type['function'], '" value="', $type['function'], '" class="input_radio" /> <label for="block_', $type['function'], '"><strong>', $txt['sp_function_' . $type['function'] . '_label'], '</strong></label>
<p class="smalltext">', $txt['sp_function_' . $type['function'] . '_desc'], '</p>
</div>
<span class="botslice"><span></span></span>
</div>
</td>';
}
echo '
</tr>
</table>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_center">
<input type="submit" name="select_type" value="', $txt['sp-blocksSelectType'], '" class="button_submit" />
</div>
<span class="botslice"><span></span></span>
</div>';
if (!empty($context['SPortal']['block']['column']))
echo '
<input type="hidden" name="block_column" value="', $context['SPortal']['block']['column'], '" />';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
?>

View File

@ -0,0 +1,338 @@
<?php
// Version: 2.3.5; PortalAdminPages
function template_pages_list()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="sp_manage_pages">
<form action="', $scripturl, '?action=admin;area=portalpages;sa=list" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['sp_pages_remove_confirm'], '\');">
<div class="sp_align_left pagesection">
', $txt['pages'], ': ', $context['page_index'], '
</div>
<table class="table_grid" cellspacing="0" width="100%">
<thead>
<tr class="catbg">';
foreach ($context['columns'] as $column)
{
if ($column['selected'])
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
<a href="', $column['href'], '">', $column['label'], '&nbsp;<img src="', $settings['images_url'], '/sort_', $context['sort_direction'], '.gif" alt="" /></a>
</th>';
elseif ($column['sortable'])
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
', $column['link'], '
</th>';
else
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
', $column['label'], '
</th>';
}
echo '
<th scope="col" class="last_th">
<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />
</th>
</tr>
</thead>
<tbody>';
if (empty($context['pages']))
{
echo '
<tr class="windowbg2">
<td class="sp_center" colspan="', count($context['columns']) + 1, '">', $txt['sp_error_no_pages'], '</td>
</tr>';
}
foreach ($context['pages'] as $page)
{
echo '
<tr class="windowbg2">
<td class="sp_left">', $page['link'], '</td>
<td class="sp_center">', $page['page_id'], '</td>
<td class="sp_center">', $page['type_text'], '</td>
<td class="sp_center">', $page['views'], '</td>
<td class="sp_center">', $page['status_image'], '</td>
<td class="sp_center">', implode('&nbsp;', $page['actions']), '</td>
<td class="sp_center"><input type="checkbox" name="remove[]" value="', $page['id'], '" class="input_check" /></td>
</tr>';
}
echo '
</tbody>
</table>
<div class="sp_align_left pagesection">
<div class="sp_float_right">
<input type="submit" name="remove_pages" value="', $txt['sp_admin_pages_remove'], '" class="button_submit" />
</div>
', $txt['pages'], ': ', $context['page_index'], '
</div>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
function template_pages_edit()
{
global $context, $settings, $options, $scripturl, $txt, $helptxt, $modSettings;
if (!empty($context['SPortal']['preview']))
{
echo '
<div class="sp_auto_align" style="width: 90%; padding-bottom: 1em;">';
template_view_page();
echo '
</div>';
}
echo '
<div id="sp_edit_page">
<form action="', $scripturl, '?action=admin;area=portalpages;sa=edit" method="post" accept-charset="', $context['character_set'], '" onsubmit="submitonce(this);">
<div class="cat_bar">
<h3 class="catbg">
', $txt['sp_admin_pages_general'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<dl class="sp_form">
<dt>
<label for="page_title">', $txt['sp_admin_pages_col_title'], ':</label>
</dt>
<dd>
<input type="text" name="title" id="page_title" value="', $context['SPortal']['page']['title'], '" class="input_text" />
</dd>
<dt>
<label for="page_namespace">', $txt['sp_admin_pages_col_namespace'], ':</label>
</dt>
<dd>
<input type="text" name="namespace" id="page_namespace" value="', $context['SPortal']['page']['page_id'], '" class="input_text" />
</dd>
<dt>
<label for="page_type">', $txt['sp_admin_pages_col_type'], ':</label>
</dt>
<dd>
<select name="type" id="page_type" onchange="sp_update_editor();">';
$content_types = array('bbc', 'html', 'php');
foreach ($content_types as $type)
echo '
<option value="', $type, '"', $context['SPortal']['page']['type'] == $type ? ' selected="selected"' : '', '>', $txt['sp_pages_type_' . $type], '</option>';
echo '
</select>
</dd>
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp_permissions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="page_permission_set">', $txt['sp_admin_pages_col_permissions'], ':</label>
</dt>
<dd>
<select name="permission_set" id="page_permission_set" onchange="sp_update_permissions();">';
$permission_sets = array(1 => 'guests', 2 => 'members', 3 => 'everyone', 0 => 'custom');
foreach ($permission_sets as $id => $label)
echo '
<option value="', $id, '"', $id == $context['SPortal']['page']['permission_set'] ? ' selected="selected"' : '', '>', $txt['sp_admin_pages_permissions_set_' . $label], '</option>';
echo '
</select>
</dd>
<dt id="page_custom_permissions_label">
', $txt['sp_admin_pages_col_custom_permissions'], ':
</dt>
<dd id="page_custom_permissions_input">
<table>
<tr>
<th>', $txt['sp_admin_pages_custom_permissions_membergroup'], '</td>
<th title="', $txt['sp_admin_pages_custom_permissions_allowed'], '">', $txt['sp_admin_pages_custom_permissions_allowed_short'], '</th>
<th title="', $txt['sp_admin_pages_custom_permissions_disallowed'], '">', $txt['sp_admin_pages_custom_permissions_disallowed_short'], '</th>
<th title="', $txt['sp_admin_pages_custom_permissions_denied'], '">', $txt['sp_admin_pages_custom_permissions_denied_short'], '</th>
</tr>';
foreach ($context['SPortal']['page']['groups'] as $id => $label)
{
$current = 0;
if (in_array($id, $context['SPortal']['page']['groups_allowed']))
$current = 1;
elseif (in_array($id, $context['SPortal']['page']['groups_denied']))
$current = -1;
echo '
<tr>
<td>', $label, '</td>
<td><input type="radio" name="membergroups[', $id, ']" value="1"', $current == 1 ? ' checked="checked"' : '', ' class="input_radio"></td>
<td><input type="radio" name="membergroups[', $id, ']" value="0"', $current == 0 ? ' checked="checked"' : '', ' class="input_radio"></td>
<td><input type="radio" name="membergroups[', $id, ']" value="-1"', $current == -1 ? ' checked="checked"' : '', ' class="input_radio"></td>
</tr>';
}
echo '
</table>
</dd>
<dt>
<label for="page_blocks">', $txt['sp_admin_pages_col_blocks'], ':</label>
</dt>
<dd>
<select name="blocks[]" id="page_blocks" size="7" multiple="multiple">';
foreach ($context['sides'] as $side => $label)
{
if (empty($context['page_blocks'][$side]))
continue;
echo '
<optgroup label="', $label, '">';
foreach ($context['page_blocks'][$side] as $block)
{
echo '
<option value="', $block['id'], '"', $block['shown'] ? ' selected="selected"' : '', '>', $block['label'], '</option>';
}
echo '
</optgroup>';
}
echo '
</select>
</dd>
<dt>
<label for="page_status">', $txt['sp_admin_pages_col_status'], ':</label>
</dt>
<dd>
<input type="checkbox" name="status" id="page_status" value="1"', $context['SPortal']['page']['status'] ? ' checked="checked"' : '', ' class="input_check" /></dd>
<dt>
', $txt['sp_admin_pages_col_body'], ':
</dt>
<dd>
</dd>
</dl>
<div id="sp_rich_editor">
<div id="sp_rich_bbc"', $context['SPortal']['page']['type'] != 'bbc' ? ' style="display: none;"' : '', '></div>
<div id="sp_rich_smileys"', $context['SPortal']['page']['type'] != 'bbc' ? ' style="display: none;"' : '', '></div>
<div>', template_control_richedit($context['post_box_name'], 'sp_rich_smileys', 'sp_rich_bbc'), '</div>
</div>
<div class="sp_button_container">
<input type="submit" name="preview" value="', $txt['sp_admin_pages_preview'], '" class="button_submit" /> <input type="submit" name="submit" value="', $context['page_title'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>';
$style_sections = array('title' => 'left', 'body' => 'right');
$style_types = array('default' => 'DefaultClass', 'class' => 'CustomClass', 'style' => 'CustomStyle');
$style_parameters = array(
'title' => array('catbg', 'catbg2', 'catbg3', 'titlebg', 'titlebg2'),
'body' => array('windowbg', 'windowbg2', 'windowbg3', 'information', 'roundframe'),
);
echo '
<br />
<div class="cat_bar">
<h3 class="catbg">
', $txt['sp_admin_pages_style'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">';
foreach ($style_sections as $section => $float)
{
echo '
<dl id="sp_edit_style_', $section, '" class="sp_form sp_float_', $float, '">';
foreach ($style_types as $type => $label)
{
echo '
<dt>
', $txt['sp-blocks' . ucfirst($section) . $label], ':
</dt>
<dd>';
if ($type == 'default')
{
echo '
<select name="', $section, '_default_class" id="', $section, '_default_class">';
foreach ($style_parameters[$section] as $class)
echo '
<option value="', $class, '"', $context['SPortal']['page']['style'][$section . '_default_class'] == $class ? ' selected="selected"' : '', '>', $class, '</option>';
echo '
</select>';
}
else
echo '
<input type="text" name="', $section, '_custom_', $type, '" id="', $section, '_custom_', $type, '" value="', $context['SPortal']['page']['style'][$section . '_custom_' . $type], '" class="input_text" />';
echo '
</dd>';
}
echo '
<dt>
', $txt['sp-blocksNo' . ucfirst($section)], ':
</dt>
<dd>
<input type="checkbox" name="no_', $section, '" id="no_', $section, '" value="1"', !empty($context['SPortal']['page']['style']['no_' . $section]) ? ' checked="checked"' : '', ' onclick="document.getElementById(\'', $section, '_default_class\').disabled', $section == 'title' ? ' = document.getElementById(\'title_custom_class\').disabled = document.getElementById(\'title_custom_style\').disabled' : '', ' = this.checked;" class="input_check" />
</dd>
</dl>';
}
echo '
<div class="sp_button_container">
<input type="submit" name="preview" value="', $txt['sp_admin_pages_preview'], '" class="button_submit" /> <input type="submit" name="submit" value="', $context['page_title'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<input type="hidden" name="page_id" value="', $context['SPortal']['page']['id'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
document.getElementById("title_default_class").disabled = document.getElementById("no_title").checked;
document.getElementById("title_custom_class").disabled = document.getElementById("no_title").checked;
document.getElementById("title_custom_style").disabled = document.getElementById("no_title").checked;
document.getElementById("body_default_class").disabled = document.getElementById("no_body").checked;
sp_update_permissions();
function sp_update_editor()
{
var new_state = document.getElementById("page_type").value;
if (new_state == "bbc")
{
document.getElementById("sp_rich_bbc").style.display = "";
document.getElementById("sp_rich_smileys").style.display = "";
}
else
{
if (oEditorHandle_content.bRichTextEnabled)
oEditorHandle_content.toggleView();
document.getElementById("sp_rich_bbc").style.display = "none";
document.getElementById("sp_rich_smileys").style.display = "none";
}
}
function sp_update_permissions()
{
var new_state = document.getElementById("page_permission_set").value;
document.getElementById("page_custom_permissions_label").style.display = new_state != 0 ? "none" : "";
document.getElementById("page_custom_permissions_input").style.display = new_state != 0 ? "none" : "";
}
// ]]></script>';
}
?>

View File

@ -0,0 +1,339 @@
<?php
// Version: 2.3.5; PortalAdminShoutbox
function template_shoutbox_list()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
echo '
<div id="sp_manage_shoutboxes">
<form action="', $scripturl, '?action=admin;area=portalshoutbox;sa=list" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['sp_shoutbox_remove_confirm'], '\');">
<div class="sp_align_left pagesection">
', $txt['pages'], ': ', $context['page_index'], '
</div>
<table class="table_grid" cellspacing="0" width="100%">
<thead>
<tr class="catbg">';
foreach ($context['columns'] as $column)
{
if ($column['selected'])
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
<a href="', $column['href'], '">', $column['label'], '&nbsp;<img src="', $settings['images_url'], '/sort_', $context['sort_direction'], '.gif" alt="" /></a>
</th>';
elseif ($column['sortable'])
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
', $column['link'], '
</th>';
else
echo '
<th scope="col"', isset($column['class']) ? ' class="' . $column['class'] . '"' : '', isset($column['width']) ? ' width="' . $column['width'] . '"' : '', '>
', $column['label'], '
</th>';
}
echo '
<th scope="col" class="last_th">
<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);" />
</th>
</tr>
</thead>
<tbody>';
if (empty($context['shoutboxes']))
{
echo '
<tr class="windowbg2">
<td class="sp_center" colspan="', count($context['columns']) + 1, '">', $txt['sp_error_no_shoutbox'], '</td>
</tr>';
}
foreach ($context['shoutboxes'] as $shoutbox)
{
echo '
<tr class="windowbg2">
<td class="sp_left">', $shoutbox['name'], '</td>
<td class="sp_center">', $shoutbox['shouts'], '</td>
<td class="sp_center">', $shoutbox['caching'] ? $txt['sp_yes'] : $txt['sp_no'], '</td>
<td class="sp_center">', $shoutbox['status_image'], '</td>
<td class="sp_center">', implode('&nbsp;', $shoutbox['actions']), '</td>
<td class="sp_center"><input type="checkbox" name="remove[]" value="', $shoutbox['id'], '" class="input_check" /></td>
</tr>';
}
echo '
</tbody>
</table>
<div class="sp_align_left pagesection">
<div class="sp_float_right">
<input type="submit" name="remove_shoutbox" value="', $txt['sp_admin_shoutbox_remove'], '" class="button_submit" />
</div>
', $txt['pages'], ': ', $context['page_index'], '
</div>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>';
}
function template_shoutbox_edit()
{
global $context, $settings, $options, $scripturl, $txt, $helptxt, $modSettings;
echo '
<div id="sp_edit_shoutbox">
<form action="', $scripturl, '?action=admin;area=portalshoutbox;sa=edit" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
', $context['page_title'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<dl class="sp_form">
<dt>
<label for="shoutbox_name">', $txt['sp_admin_shoutbox_col_name'], ':</label>
</dt>
<dd>
<input type="text" name="name" id="shoutbox_name" value="', $context['SPortal']['shoutbox']['name'], '" class="input_text" />
</dd>
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp_permissions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="shoutbox_permission_set">', $txt['sp_admin_shoutbox_col_permissions'], ':</label>
</dt>
<dd>
<select name="permission_set" id="shoutbox_permission_set" onchange="sp_update_permissions();">';
$permission_sets = array(1 => 'guests', 2 => 'members', 3 => 'everyone', 0 => 'custom');
foreach ($permission_sets as $id => $label)
echo '
<option value="', $id, '"', $id == $context['SPortal']['shoutbox']['permission_set'] ? ' selected="selected"' : '', '>', $txt['sp_admin_shoutbox_permissions_set_' . $label], '</option>';
echo '
</select>
</dd>
<dt id="shoutbox_custom_permissions_label">
', $txt['sp_admin_shoutbox_col_custom_permissions'], ':
</dt>
<dd id="shoutbox_custom_permissions_input">
<table>
<tr>
<th>', $txt['sp_admin_shoutbox_custom_permissions_membergroup'], '</td>
<th title="', $txt['sp_admin_shoutbox_custom_permissions_allowed'], '">', $txt['sp_admin_shoutbox_custom_permissions_allowed_short'], '</th>
<th title="', $txt['sp_admin_shoutbox_custom_permissions_disallowed'], '">', $txt['sp_admin_shoutbox_custom_permissions_disallowed_short'], '</th>
<th title="', $txt['sp_admin_shoutbox_custom_permissions_denied'], '">', $txt['sp_admin_shoutbox_custom_permissions_denied_short'], '</th>
</tr>';
foreach ($context['SPortal']['shoutbox']['groups'] as $id => $label)
{
$current = 0;
if (in_array($id, $context['SPortal']['shoutbox']['groups_allowed']))
$current = 1;
elseif (in_array($id, $context['SPortal']['shoutbox']['groups_denied']))
$current = -1;
echo '
<tr>
<td>', $label, '</td>
<td><input type="radio" name="membergroups[', $id, ']" value="1"', $current == 1 ? ' checked="checked"' : '', ' class="input_radio"></td>
<td><input type="radio" name="membergroups[', $id, ']" value="0"', $current == 0 ? ' checked="checked"' : '', ' class="input_radio"></td>
<td><input type="radio" name="membergroups[', $id, ']" value="-1"', $current == -1 ? ' checked="checked"' : '', ' class="input_radio"></td>
</tr>';
}
echo '
</table>
</dd>
<dt>
', $txt['sp_admin_shoutbox_col_moderators'], ':
</dt>
<dd>
<fieldset id="moderators">
<legend><a href="javascript:void(0);" onclick="document.getElementById(\'moderators\').style.display = \'none\';document.getElementById(\'moderators_groups_link\').style.display = \'block\'; return false;">', $txt['avatar_select_permission'], '</a></legend>
<ul class="permission_groups">';
foreach ($context['moderator_groups'] as $group)
{
echo '
<li><input type="checkbox" name="moderator_groups[', $group['id'], ']" id="moderator_groups_', $group['id'], '" value="', $group['id'], '"', !empty($group['checked']) ? ' checked="checked"' : '', ' class="input_check" /> <label for="moderator_groups_', $group['id'], '"', $group['is_post_group'] ? ' style="font-style: italic;"' : '', '>', $group['name'], '</label></li>';
}
echo '
<li><input type="checkbox" id="moderator_groups_all" onclick="invertAll(this, this.form, \'moderator_groups\');" class="input_check" /> <label for="moderator_groups_all"><em>', $txt['check_all'], '</em></label></li>
</ul>
</fieldset>
<a href="javascript:void(0);" onclick="document.getElementById(\'moderators\').style.display = \'block\'; document.getElementById(\'moderators_groups_link\').style.display = \'none\'; return false;" id="moderators_groups_link" style="display: none;">[ ', $txt['avatar_select_permission'], ' ]</a>
<script type="text/javascript"><!-- // --><![CDATA[
document.getElementById("moderators").style.display = "none";
document.getElementById("moderators_groups_link").style.display = "";
// ]]></script>
</dd>
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp-shoutboxesWarning" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="shoutbox_warning">', $txt['sp_admin_shoutbox_col_warning'], ':</label>
</dt>
<dd>
<input type="text" name="warning" id="shoutbox_warning" value="', $context['SPortal']['shoutbox']['warning'], '" size="25" class="input_text" />
</dd>
<dt>
<a href="', $scripturl, '?action=helpadmin;help=sp-shoutboxesBBC" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" class="icon" /></a>
<label for="shoutbox_bbc">', $txt['sp_admin_shoutbox_col_bbc'], ':</label>
</dt>
<dd>
<select name="allowed_bbc[]" id="shoutbox_bbc" size="7" multiple="multiple">';
foreach ($context['allowed_bbc'] as $tag => $label)
if (!isset($context['disabled_tags'][$tag]))
echo '
<option value="', $tag, '"', in_array($tag, $context['SPortal']['shoutbox']['allowed_bbc']) ? ' selected="selected"' : '', '>[', $tag, '] - ', $label, '</option>';
echo '
</select>
</dd>
<dt>
<label for="shoutbox_height">', $txt['sp_admin_shoutbox_col_height'], '</label>
</dt>
<dd>
<input type="text" name="height" id="shoutbox_height" value="', $context['SPortal']['shoutbox']['height'], '" size="10" class="input_text" />
</dd>
<dt>
<label for="shoutbox_num_show">', $txt['sp_admin_shoutbox_col_num_show'], ':</label>
</dt>
<dd>
<input type="text" name="num_show" id="shoutbox_num_show" value="', $context['SPortal']['shoutbox']['num_show'], '" size="10" class="input_text" />
</dd>
<dt>
<label for="shoutbox_num_max">', $txt['sp_admin_shoutbox_col_num_max'], ':</label>
</dt>
<dd>
<input type="text" name="num_max" id="shoutbox_num_max" value="', $context['SPortal']['shoutbox']['num_max'], '" size="10" class="input_text" />
</dd>
<dt>
<label for="shoutbox_reverse">', $txt['sp_admin_shoutbox_col_reverse'], ':</label>
</dt>
<dd>
<input type="checkbox" name="reverse" id="shoutbox_reverse" value="1"', $context['SPortal']['shoutbox']['reverse'] ? ' checked="checked"' : '', ' class="input_check" />
</dd>
<dt>
<label for="shoutbox_caching">', $txt['sp_admin_shoutbox_col_caching'], ':</label>
</dt>
<dd>
<input type="checkbox" name="caching" id="shoutbox_caching" value="1"', $context['SPortal']['shoutbox']['caching'] ? ' checked="checked"' : '', ' class="input_check" />
</dd>
<dt>
<label for="shoutbox_refresh">', $txt['sp_admin_shoutbox_col_refresh'], '</label>
</dt>
<dd>
<input type="text" name="refresh" id="shoutbox_refresh" value="', $context['SPortal']['shoutbox']['refresh'], '" size="10" class="input_text" />
</dd>
<dt>
<label for="shoutbox_status">', $txt['sp_admin_shoutbox_col_status'], ':</label>
</dt>
<dd>
<input type="checkbox" name="status" id="shoutbox_status" value="1"', $context['SPortal']['shoutbox']['status'] ? ' checked="checked"' : '', ' class="input_check" />
</dd>
</dl>
<div class="sp_button_container">
<input type="submit" name="submit" value="', $context['page_title'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<input type="hidden" name="shoutbox_id" value="', $context['SPortal']['shoutbox']['id'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
sp_update_permissions();
function sp_update_permissions()
{
var new_state = document.getElementById("shoutbox_permission_set").value;
document.getElementById("shoutbox_custom_permissions_label").style.display = new_state != 0 ? "none" : "";
document.getElementById("shoutbox_custom_permissions_input").style.display = new_state != 0 ? "none" : "";
}
// ]]></script>';
}
function template_shoutbox_prune()
{
global $context, $scripturl, $settings, $txt;
echo '
<div id="sp_prune_shoutbox">
<form action="', $scripturl, '?action=admin;area=portalshoutbox;sa=prune" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">
', $context['page_title'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<dl class="sp_form">
<dt>
<input type="radio" name="type" id="type_all" value="all" class="input_radio" /> <label for="type_all">', $txt['sp_admin_shoutbox_opt_all'], '</label>
</dt>
<dd>
</dd>
<dt>
<input type="radio" name="type" id="type_days" value="days" class="input_radio" /> <label for="type_days">', $txt['sp_admin_shoutbox_opt_days'], '</label>
</dt>
<dd>
<input type="text" name="days" value="" size="5" onfocus="document.getElementById(\'type_days\').checked = true;" class="input_text" />
</dd>
<dt>
<input type="radio" name="type" id="type_member" value="member" class="input_radio" /> <label for="type_member">', $txt['sp_admin_shoutbox_opt_member'], '</label>
</dt>
<dd>
<input type="text" name="member" id="member" value="" onclick="document.getElementById(\'type_member\').checked = true;" size="15" class="input_text" />
</dd>
</dl>
<div class="sp_button_container">
<input type="submit" name="submit" value="', $context['page_title'], '" class="button_submit" />
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<input type="hidden" name="shoutbox_id" value="', $context['shoutbox']['id'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
<script type="text/javascript"><!-- // --><![CDATA[
var oAddBuddySuggest = new smc_AutoSuggest({
sSelf: \'oAddBuddySuggest\',
sSessionId: \'', $context['session_id'], '\',
sSessionVar: \'', $context['session_var'], '\',
sSuggestId: \'member\',
sControlId: \'member\',
sSearchType: \'member\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
bItemList: false
});
// ]]></script>';
}
function template_shoutbox_block_redirect()
{
global $context;
echo '
<div id="sp_shoutbox_redirect">
<div class="cat_bar">
<h3 class="catbg">
', $context['page_title'], '
</h3>
</div>
<div class="windowbg2">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
', $context['redirect_message'], '
</div>
<span class="botslice"><span></span></span>
</div>
</div>';
}
?>

View File

@ -0,0 +1,189 @@
<?php
// Version: 2.3.5; PortalArticles
function template_articles()
{
global $context;
if ($context['SPortal']['core_compat'])
template_articles_core();
else
template_articles_curve();
}
function template_articles_core()
{
global $context, $txt, $modSettings, $scripturl;
if (empty($modSettings['articleactive']))
return;
while ($article = $context['get_articles']())
{
echo '
<div class="tborder sp_article_content">
<table class="sp_block">
<tr class="catbg">
<td class="sp_middle">', $article['message']['icon'], '</td>
<td class="sp_middle sp_regular_padding sp_fullwidth">', $article['topic']['link'], '</td>
</tr>
<tr class="windowbg">
<td class="sp_regular_padding" colspan="2">';
if (!empty($modSettings['articleavatar']) && $article['poster']['avatar']['name'] !== null && !empty($article['poster']['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $article['poster']['id'], '"><img src="', $article['poster']['avatar']['href'], '" alt="', $article['poster']['name'], '" width="30" style="float: right;" /></a>
<div class="middletext">', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';
else
echo '
<div class="middletext">', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';
echo '
<div class="post"><hr />', !empty($article['category']['picture']['href']) ? '<div><img src="' . $article['category']['picture']['href'] . '" alt="' . $article['category']['name'] . '" class="sp_article_image" align="right" /></div>' : '', $article['message']['body'], '<br/><br/>
</div>
</td>
</tr>
<tr>
<td class="windowbg2" colspan="2">
<div class="sp_right sp_regular_padding">', $article['article']['link'], ' ', $article['article']['new_comment'], '</div>
</td>
</tr>
</table>
</div>';
}
if (!empty($modSettings['articleperpage']) && !empty($context['page_index']))
echo '
<div class="sp_page_index">', $txt['sp-articlesPages'], ': ', $context['page_index'], '</div>';
}
function template_articles_curve()
{
global $context, $txt, $modSettings, $scripturl;
if (empty($modSettings['articleactive']))
return;
while ($article = $context['get_articles']())
{
echo '
<div class="cat_bar">
<h3 class="catbg">
<span class="sp_float_left sp_article_icon">', $article['message']['icon'], '</span>', $article['topic']['link'], '
</h3>
</div>
<div class="windowbg sp_article_content">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">';
if (!empty($modSettings['articleavatar']) && $article['poster']['avatar']['name'] !== null && !empty($article['poster']['avatar']['href']))
echo '
<a href="', $scripturl, '?action=profile;u=', $article['poster']['id'], '"><img src="', $article['poster']['avatar']['href'], '" alt="', $article['poster']['name'], '" width="30" class="sp_float_right" /></a>
<div class="middletext">', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], '<br />', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';
else
echo '
<div class="middletext">', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '</div>';
echo '
<div class="post"><hr />', !empty($article['category']['picture']['href']) ? '<div><img src="' . $article['category']['picture']['href'] . '" alt="' . $article['category']['name'] . '" class="sp_article_image sp_float_right" /></div>' : '', $article['message']['body'], '</div>
<div class="sp_right">', $article['article']['link'], ' ', $article['article']['new_comment'], '</div>
</div>
<span class="botslice"><span></span></span>
</div>';
}
if (!empty($modSettings['articleperpage']) && !empty($context['page_index']))
echo '
<div class="sp_page_index">', $txt['sp-articlesPages'], ': ', $context['page_index'], '</div>';
}
function template_add_article()
{
global $context;
if ($context['SPortal']['core_compat'])
template_add_article_core();
else
template_add_article_curve();
}
function template_add_article_core()
{
global $context, $scripturl, $txt;
echo '<br />
<table border="0" align="center" cellspacing="1" cellpadding="4" class="tborder" width="40%">
<tr class="catbg">
<td>', $txt['sp-articlesAdd'], '</td>
</tr>
<tr class="windowbg2">
<td align="center">
<form action="', $scripturl, '?action=portal;sa=addarticle" method="post" accept-charset="', $context['character_set'], '">
<table cellpadding="4">
<tr>
<th align="right">', $txt['sp-articlesCategory'], ':</th>
<td align="left">
<select id="category" name="category">';
foreach($context['list_categories'] as $category)
echo '
<option value="', $category['id'], '">', $category['name'], '</option>';
echo '
</select>
</td>
</tr><tr>
<td colspan="2" align="center"><input type="submit" name="add_article" value="', $txt['sp-articlesAdd'], '" class="button_submit" /></td>
</tr>
</table>
<input type="hidden" name="return" value="', $context['return'], '" />
<input type="hidden" name="message" value="', $context['message'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</td>
</tr>
</table>';
}
function template_add_article_curve()
{
global $context, $scripturl, $txt;
echo '
<div class="sp_auto_align" style="width: 40%;">
<div class="cat_bar">
<h3 class="catbg">
', $txt['sp-articlesAdd'], '
</h3>
</div>
<div class="sp_center windowbg2">
<span class="topslice"><span></span></span>
<form action="', $scripturl, '?action=portal;sa=addarticle" method="post" accept-charset="', $context['character_set'], '">
<dl class="settings">
<dt class="sp_right">
<strong>', $txt['sp-articlesCategory'], ':</strong>
</dt>
<dd class="sp_left" style="margin-left: 10px;">
<select id="category" name="category">';
foreach($context['list_categories'] as $category)
echo '
<option value="', $category['id'], '">', $category['name'], '</option>';
echo '
</select>
</dd>
</dl>
<p>
<input type="submit" name="add_article" value="', $txt['sp-articlesAdd'], '" class="button_submit" />
</p>
<input type="hidden" name="return" value="', $context['return'], '" />
<input type="hidden" name="message" value="', $context['message'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
<span class="botslice"><span></span></span>
</div>
</div>';
}
?>

View File

@ -0,0 +1,96 @@
<?php
// Version: 2.3.5; PortalPages
function template_view_page()
{
global $context;
if ($context['SPortal']['core_compat'])
template_view_page_core();
else
template_view_page_curve();
}
function template_view_page_core()
{
global $context;
echo '
<div', !empty($context['SPortal']['page']['style']['no_body']) ? '' : ' class="tborder"', '>
<table class="sp_block">';
if (empty($context['SPortal']['page']['style']['no_title']))
echo '
<tr>
<td class="sp_block_padding ', $context['SPortal']['page']['style']['title']['class'], '"', !empty($context['SPortal']['page']['style']['title']['style']) ? ' style="' . $context['SPortal']['page']['style']['title']['style'] . '"' : '', '>
', $context['SPortal']['page']['title'], '
</td>
</tr>';
echo '
<tr>
<td class="sp_block_padding', empty($context['SPortal']['page']['style']['body']['class']) ? '' : ' ' . $context['SPortal']['page']['style']['body']['class'], '"', !empty($context['SPortal']['page']['style']['body']['style']) ? ' style="' . $context['SPortal']['page']['style']['body']['style'] . '"' : '', '>';
sportal_parse_page($context['SPortal']['page']['body'], $context['SPortal']['page']['type']);
echo '
</td>
</tr>
</table>
</div>';
}
function template_view_page_curve()
{
global $context;
if (empty($context['SPortal']['page']['style']['no_title']))
{
echo '
<div class="', in_array($context['SPortal']['page']['style']['title']['class'], array('titlebg', 'titlebg2')) ? 'title_bar' : 'cat_bar', '"', !empty($context['SPortal']['page']['style']['title']['style']) ? ' style="' . $context['SPortal']['page']['style']['title']['style'] . '"' : '', '>
<h3 class="', $context['SPortal']['page']['style']['title']['class'], '">
', $context['SPortal']['page']['title'], '
</h3>
</div>';
}
if (strpos($context['SPortal']['page']['style']['body']['class'], 'roundframe') !== false)
{
echo '
<span class="upperframe"><span></span></span>';
}
echo '
<div class="', $context['SPortal']['page']['style']['body']['class'], '">';
if (empty($context['SPortal']['page']['style']['no_body']))
{
echo '
<span class="topslice"><span></span></span>';
}
echo '
<div class="sp_content_padding"', !empty($context['SPortal']['page']['style']['body']['style']) ? ' style="' . $context['SPortal']['page']['style']['body']['style'] . '"' : '', '>';
sportal_parse_page($context['SPortal']['page']['body'], $context['SPortal']['page']['type']);
echo '
</div>';
if (empty($context['SPortal']['page']['style']['no_body']))
{
echo '
<span class="botslice"><span></span></span>';
}
echo '
</div>';
if (strpos($context['SPortal']['page']['style']['body']['class'], 'roundframe') !== false)
{
echo '
<span class="lowerframe"><span></span></span>';
}
}
?>

View File

@ -0,0 +1,277 @@
<?php
// Version: 2.3.5; PortalShoutbox
function template_shoutbox_all()
{
global $context;
if ($context['SPortal']['core_compat'])
template_shoutbox_all_core();
else
template_shoutbox_all_curve();
}
function template_shoutbox_all_core()
{
global $context, $scripturl, $settings, $txt;
echo '
<div class="tborder">
<div class="shoutbox_container">
<div class="catbg shoutbox_padding">
', $context['SPortal']['shoutbox']['name'], '
</div>
<div class="shoutbox_page_index windowbg smalltext">
', $txt['pages'], ': ', $context['page_index'], '
</div>
<div class="windowbg shoutbox_body">
<ul class="shoutbox_list_all" id="shouts">';
if (!empty($context['SPortal']['shouts_history']))
foreach ($context['SPortal']['shouts_history'] as $shout)
echo '
', !$shout['is_me'] ? '<li class="smalltext"><strong>' . $shout['author']['link'] . ':</strong></li>' : '', '
<li class="smalltext">', str_replace('ignored_shout', 'history_ignored_shout', $shout['text']), '</li>
<li class="smalltext shoutbox_time">', $shout['delete_link'], $shout['time'], '</li>';
else
echo '
<li class="smalltext">', $txt['sp_shoutbox_no_shout'], '</li>';
echo '
</ul>
</div>
<div class="shoutbox_page_index windowbg smalltext">
', $txt['pages'], ': ', $context['page_index'], '
</div>
</div>
</div>';
}
function template_shoutbox_all_curve()
{
global $context, $scripturl, $settings, $txt;
echo '
<div class="cat_bar">
<h3 class="catbg">
', $context['SPortal']['shoutbox']['name'], '
</h3>
</div>
<div class="windowbg">
<span class="topslice"><span></span></span>
<div class="sp_content_padding">
<div class="shoutbox_page_index smalltext">
', $txt['pages'], ': ', $context['page_index'], '
</div>
<div class="shoutbox_body">
<ul class="shoutbox_list_all" id="shouts">';
if (!empty($context['SPortal']['shouts_history']))
foreach ($context['SPortal']['shouts_history'] as $shout)
echo '
', !$shout['is_me'] ? '<li class="smalltext"><strong>' . $shout['author']['link'] . ':</strong></li>' : '', '
<li class="smalltext">', str_replace('ignored_shout', 'history_ignored_shout', $shout['text']), '</li>
<li class="smalltext shoutbox_time">', $shout['delete_link'], $shout['time'], '</li>';
else
echo '
<li class="smalltext">', $txt['sp_shoutbox_no_shout'], '</li>';
echo '
</ul>
</div>
<div class="shoutbox_page_index smalltext">
', $txt['pages'], ': ', $context['page_index'], '
</div>
</div>
<span class="botslice"><span></span></span>
</div>';
}
function template_shoutbox_embed($shoutbox)
{
global $context, $scripturl, $settings, $txt;
echo '
<form action="" method="post">
<div class="shoutbox_container">
<div class="shoutbox_info">
<div id="shoutbox_load_', $shoutbox['id'], '" style="float: right; display: none;"><img src="', $settings['sp_images_url'], '/loading.gif" alt="" /></div>
<a href="', $scripturl, '?action=portal;sa=shoutbox;shoutbox_id=', $shoutbox['id'], '" onclick="sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], '); return false;">', sp_embed_image('refresh'), '</a> <a href="', $scripturl, '?action=portal;sa=shoutbox;shoutbox_id=', $shoutbox['id'], '">', sp_embed_image('history'), '</a>';
if ($context['can_shout'])
echo ' <a href="#smiley" onclick="sp_collapse_object(\'sb_smiley_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('smiley'), '</a> <a href="#style" onclick="sp_collapse_object(\'sb_style_', $shoutbox['id'], '\', false); return false;">', sp_embed_image('style'), '</a>';
echo '
</div>';
if ($context['can_shout'])
{
echo '
<div id="sp_object_sb_smiley_', $shoutbox['id'], '" style="display: none;">';
foreach ($shoutbox['smileys']['normal'] as $smiley)
echo '
<a href="javascript:void(0);" onclick="replaceText(\' ', $smiley['code'], '\', document.getElementById(\'new_shout_', $shoutbox['id'], '\')); return false;"><img src="', $settings['smileys_url'], '/', $smiley['filename'], '" alt="', $smiley['description'], '" title="', $smiley['description'], '" /></a>';
if (!empty($shoutbox['smileys']['popup']))
echo '
<a onclick="sp_showMoreSmileys(\'', $shoutbox['id'], '\', \'', $txt['more_smileys_title'], '\', \'', $txt['more_smileys_pick'], '\', \'', $txt['more_smileys_close_window'], '\', \'', $settings['theme_url'], '\', \'', $settings['smileys_url'], '\'); return false;" href="javascript:void(0);">[', $txt['more_smileys'], ']</a>';
echo '
</div>
<div id="sp_object_sb_style_', $shoutbox['id'], '" style="display: none;">';
foreach ($shoutbox['bbc'] as $image => $tag)
{
if (!in_array($tag['code'], $shoutbox['allowed_bbc']))
continue;
if (!isset($tag['after']))
echo '<a href="javascript:void(0);" onclick="replaceText(\'', $tag['before'], '\', document.getElementById(\'new_shout_', $shoutbox['id'], '\')); return false;">';
else
echo '<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.getElementById(\'new_shout_', $shoutbox['id'], '\')); return false;">';
echo '<img onmouseover="style_highlight(this, true);" onmouseout="if (window.style_highlight) style_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}
echo '
</div>';
}
echo '
<div class="shoutbox_body">
<ul class="shoutbox_list_compact" id="shouts_', $shoutbox['id'], '"', !empty($shoutbox['height']) ? ' style="height: ' . $shoutbox['height'] . 'px;"' : '', '>';
if (!empty($shoutbox['warning']))
echo '
<li class="shoutbox_warning smalltext">', $shoutbox['warning'], '</li>';
if (!empty($shoutbox['shouts']))
foreach ($shoutbox['shouts'] as $shout)
echo '
<li class="smalltext">', !$shout['is_me'] ? '<strong>' . $shout['author']['link'] . ':</strong> ' : '', $shout['text'], '<br />', !empty($shout['delete_link_js']) ? '<span class="shoutbox_delete">' . $shout['delete_link_js'] . '</span>' : '' , '<span class="smalltext shoutbox_time">', $shout['time'], '</span></li>';
else
echo '
<li class="smalltext">', $txt['sp_shoutbox_no_shout'], '</li>';
echo '
</ul>
</div>';
if ($context['can_shout'])
echo '
<div class="shoutbox_input smalltext">
<input type="text" name="new_shout" id="new_shout_', $shoutbox['id'], '" class="shoutbox_input sp_float_left input_text"', $context['browser']['is_ie'] ? ' onkeypress="if (sp_catch_enter(event)) { sp_submit_shout(' . $shoutbox['id'] . ', \'' . $context['session_var'] . '\', \'' . $context['session_id'] . '\'); return false; }"' : '', ' />
<input type="submit" name="submit_shout" value="', $txt['sp_shoutbox_button'], '" class="sp_float_right button_submit" onclick="sp_submit_shout(', $shoutbox['id'], ', \'', $context['session_var'], '\', \'', $context['session_id'], '\'); return false;" />
</div>';
echo '
</div>
<input type="hidden" name="shoutbox_id" value="', $shoutbox['id'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
<script language="Javascript" type="text/javascript"><!-- // --><![CDATA[
var last_refresh_', $shoutbox['id'], ' = ', time(), ';';
if ($shoutbox['reverse'])
echo '
var objDiv = document.getElementById("shouts_', $shoutbox['id'], '");
objDiv.scrollTop = objDiv.scrollHeight;';
if (!empty($shoutbox['refresh']))
echo '
var interval_id_', $shoutbox['id'], ' = setInterval( "sp_auto_refresh_', $shoutbox['id'], '()", ', $shoutbox['refresh'], ' * 1000);
function sp_auto_refresh_', $shoutbox['id'], '()
{
if (window.XMLHttpRequest)
{
sp_refresh_shout(', $shoutbox['id'], ', last_refresh_', $shoutbox['id'], ');
}
else
clearInterval(interval_id_', $shoutbox['id'], ');
}';
// Setup the data for the popup smileys.
if (!empty($shoutbox['smileys']['popup']))
{
echo '
if (sp_smileys == undefined)
var sp_smileys = [';
foreach ($shoutbox['smileys']['popup'] as $smiley)
{
echo '
["', $smiley['code'], '","', $smiley['filename'], '","', $smiley['js_description'], '"]';
if (empty($smiley['last']))
echo ',';
}
echo ']';
echo '
if (sp_moreSmileysTemplate == undefined)
{
var sp_moreSmileysTemplate = ', JavaScriptEscape('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>' . $txt['more_smileys_title'] . '</title>
<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/css/index' . $context['theme_variant'] . '.css?rc2" />
</head>
<body id="help_popup">
<div class="padding windowbg">
<div class="cat_bar">
<h3 class="catbg">
' . $txt['more_smileys_pick'] . '
</h3>
</div>
<div class="padding">
%smileyRows%
</div>
<div class="smalltext centertext">
<a href="javascript:window.close();">' . $txt['more_smileys_close_window'] . '</a>
</div>
</div>
</body>
</html>'), '
}';
}
echo '
// ]]></script>';
}
function template_shoutbox_xml()
{
global $context, $txt;
echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
<smf>
<shoutbox>', $context['SPortal']['shoutbox']['id'], '</shoutbox>';
if ($context['SPortal']['updated'])
{
echo '
<updated>1</updated>
<error>', empty($context['SPortal']['shouts']) ? $txt['sp_shoutbox_no_shout'] : 0, '</error>
<warning>', !empty($context['SPortal']['shoutbox']['warning']) ? htmlspecialchars($context['SPortal']['shoutbox']['warning']) : 0, '</warning>
<reverse>', !empty($context['SPortal']['shoutbox']['reverse']) ? 1 : 0, '</reverse>';
foreach ($context['SPortal']['shouts'] as $shout)
echo '
<shout>
<id>', $shout['id'], '</id>
<author>', htmlspecialchars($shout['author']['link']), '</author>
<time>', htmlspecialchars($shout['time']), '</time>
<timeclean>', htmlspecialchars(strip_tags($shout['time'])), '</timeclean>
<delete>', !empty($shout['delete_link_js']) ? htmlspecialchars($shout['delete_link_js']) : 0, '</delete>
<content>', htmlspecialchars($shout['text']), '</content>
<is_me>', $shout['is_me'] ? 1 : 0, '</is_me>
</shout>';
}
else
echo '
<updated>0</updated>';
echo '
</smf>';
}
?>

View File

@ -0,0 +1,600 @@
/* Version 2.3.5; portal */
/* ************************************* */
/* Common styles */
/* ************************************* */
.sp_table
{
border-collapse: collapse;
border-spacing: 0;
width: 100%;
}
.sp_center
{
text-align: center;
}
.sp_right
{
text-align: right;
}
.sp_left
{
text-align: left;
}
.sp_middle
{
vertical-align: middle;
}
.sp_top
{
vertical-align: top;
}
.sp_auto_align
{
margin: 0 auto;
}
.sp_float_left
{
float: left;
}
.sp_float_right
{
float: right;
}
.sp_regular_padding
{
padding: 5px;
}
.sp_content_padding
{
padding: 0 0.8em;
}
.sp_fullwidth
{
width: 100%;
}
.sp_page_index
{
width: 100%;
text-align: center;
}
.sp_clear
{
clear: both;
}
.sp_side_clear
{
clear: both;
line-height: 0.7em;
}
/* ************************************* */
/* List styles */
/* ************************************* */
.sp_list
{
list-style-type: none;
text-align: left;
padding: 0 0 0 5px;
line-height: 1.5em;
margin: 0;
}
.sp_list_indent
{
padding: 0 0 0 10px;
}
li.sp_list_top
{
padding-top: 5px;
}
li.sp_list_bottom
{
padding-bottom: 5px;
border-bottom: 1px dashed #AAA;
}
li.sp_list_divider
{
border-bottom: 1px solid #DDD;
}
/* ************************************* */
/* Block specific styles */
/* ************************************* */
.sp_online_flow
{
max-height: 150px;
height: auto !important;
height: 150px;
overflow: auto;
}
.sp_rss_flow
{
max-height: 300px;
height: auto !important;
height: 300px;
overflow: auto;
}
td.sp_top_poster, td.sp_staff, td.sp_blog, td.sp_articles
{
width: 45px;
}
td.sp_staff_info
{
padding: 7px 0;
vertical-align: bottom;
}
td.sp_staff_divider
{
border-bottom: 1px dashed #AAA;
}
td.sp_recent_icon
{
vertical-align: middle;
width: 5%;
}
td.sp_recent_subject
{
width: 60%;
}
td.sp_recent_info
{
width: 35%;
}
div.sp_image
{
text-align: center;
line-height: 1.4em;
padding: 5px;
}
input.sp_search
{
width: 95%;
}
.sp_acalendar
{
border-collapse: collapse;
border-spacing: 0;
width: 100%;
text-align: center;
}
td.sp_acalendar_day
{
height: 20px;
padding: 2px;
text-align: center;
vertical-align: top;
}
.sp_acalendar_divider
{
width: 80%;
}
table.sp_blog, table.sp_articles, td.sp_shop_info
{
line-height: 1.7em;
}
td.sp_shop_info
{
font-size: smaller;
}
td.sp_shop_divider
{
border-bottom: 1px dashed #AAA;
}
td.sp_shop
{
width: 40px;
}
.sp_blog_title, .sp_articles_title
{
border-bottom: 1px dashed #AAA;
}
#sp_menu
{
width: 100%;
}
#sp_menu a
{
margin: 0;
line-height: 1.7em;
}
#sp_menu li
{
position: relative;
}
#sp_menu li ul
{
position: absolute;
top: 0;
left: 75%;
width: 200px;
background: #FFFFFF;
border: 1px solid #AAA;
}
#sp_menu ul
{
display: none;
}
#sp_menu li:hover ul
{
display: block;
}
.sp_article_icon
{
margin: 5px 10px 0 0;
}
.sp_article_content
{
margin-bottom: 0.5em;
}
/* ************************************* */
/* Main layout styles */
/* ************************************* */
#sp_main
{
width: 100%;
border-spacing: 5px;
table-layout: fixed;
}
#sp_header, #sp_footer
{
vertical-align: top;
margin: 0 0.4em;
}
#sp_left
{
vertical-align: top;
}
#sp_right
{
vertical-align: top;
}
#sp_center
{
vertical-align: top;
}
div.sp_block
{
overflow: auto;
padding: 0 0.5em;
}
div.sp_block_container
{
overflow: auto;
}
table.sp_block
{
border-collapse: collapse;
border-spacing: 0;
width: 100%;
}
td.sp_block_padding
{
padding: 5px;
}
.sp_block_section
{
padding-bottom: 0.7em;
}
body
{
min-width: 750px;
}
/* ************************************* */
/* Shoutbox styles */
/* ************************************* */
table.shoutbox_container
{
width: 100%;
font-size: x-small;
}
.shoutbox_padding
{
padding: 5px;
}
.shoutbox_body
{
text-align: left;
padding: 0;
}
.shoutbox_list_compact
{
margin: 0;
padding: 0;
list-style: none;
overflow: auto;
height: 200px;
}
.shoutbox_list_compact li
{
padding: 4px 0 4px 4px;
border-bottom: 1px dashed #CCCCCC;
border-left: 3px solid #DADADA;
}
.shoutbox_list_all
{
margin: 0;
padding: 0;
list-style: none;
}
.shoutbox_list_all li
{
padding: 4px 0 0 4px;
border-left: 3px solid #DADADA;
}
li.shoutbox_time
{
border-bottom: 1px dashed #CCCCCC;
color: #777;
}
span.shoutbox_time
{
color: #777;
padding-left: 5px;
}
span.shoutbox_delete
{
float: right;
padding-right: 3px;
}
.shoutbox_page_index
{
padding: 2px 0 3px 2px;
line-height: 1.8em;
text-align: center;
}
div.shoutbox_input
{
padding-top: 5px;
}
input.shoutbox_input
{
width: 65%;
}
li.shoutbox_warning
{
border-left: 3px solid #F66;
border-bottom: none;
background: #FDD;
color: #FF0000;
}
.shoutbox_me
{
font-weight: bold;
color: #FF0000;
}
/* ************************************* */
/* Admin styles */
/* ************************************* */
#sp_admin_main
{
overflow: hidden;
margin: 1em 0;
}
#sp_live_info
{
width: 65%;
}
#sp_general_info
{
width: 34%;
}
#spAnnouncements
{
height: 18ex;
overflow: auto;
padding-right: 1ex;
}
#sp_live_info div.sp_content_padding, #sp_general_info div.sp_content_padding
{
height: 18ex;
}
#sp_credits p
{
margin: 0;
padding: 0.5em 0;
}
#sp_manage_blocks h3.titlebg a.sp_float_right
{
padding-top: 0.5em;
}
#sp_manage_blocks table.table_grid
{
margin-bottom: 0.8em;
}
#sp_select_block_type
{
width: 80%;
margin: 0 auto;
}
#sp_select_block_type div.sp_content_padding
{
height: 100px;
padding: 0 1em;
}
#sp_select_block_type li
{
float: left;
width: 150px;
height: 200px;
}
#sp_select_block_type table
{
width: 100%;
}
#sp_select_block_type td
{
width: 33%;
vertical-align: top;
}
#sp_edit_block
{
width: 70%;
margin: 0 auto;
}
#sp_edit_block #sp_display_advanced
{
padding-top: 0.6em;
line-height: 2em;
}
#sp_edit_block ul.sp_display_list
{
overflow: hidden;
margin: 0;
}
#sp_edit_block ul.sp_display_list li
{
float: left;
width: 50%;
}
#sp_manage_articles table.table_grid
{
margin: 0.4em 0;
}
#sp_article_add
{
width: 65%;
margin: 0 auto;
}
#sp_add_articles_category
{
margin-bottom: 0.5em;
}
#sp_add_articles_list
{
list-style: none;
}
#sp_add_articles_list_header
{
list-style: none;
}
#sp_add_articles_list li
{
margin-top: 0.2em;
}
#sp_edit_category
{
width: 60%;
margin: 0 auto;
}
#sp_add_articles_button
{
padding-top: 0em;
}
#sp_manage_pages table.table_grid
{
margin: 0.4em 0;
}
#sp_edit_page
{
width: 70%;
margin: 0 auto;
}
#sp_manage_shoutboxes table.table_grid
{
margin: 0.4em 0;
}
#sp_edit_shoutbox
{
width: 70%;
margin: 0 auto;
}
#sp_prune_shoutbox
{
width: 70%;
margin: 0 auto;
}
#sp_prune_shoutbox dl.sp_form dt
{
width: 65%;
}
#sp_prune_shoutbox dl.sp_form dd
{
width: 34%;
}
#sp_shoutbox_redirect
{
width: 50%;
margin: 0 auto;
}
dl#sp_edit_style_title, dl#sp_edit_style_body
{
width: 50%;
}
dl#sp_edit_style_title dt, dl#sp_edit_style_body dt
{
width: 45%;
}
dl#sp_edit_style_title dd, dl#sp_edit_style_body dd
{
width: 54%;
}
dl.sp_form
{
margin: 0;
clear: right;
overflow: auto;
}
dl.sp_form dt
{
font-weight: normal;
float: left;
clear: both;
width: 31%;
margin: 0.5em 0 0 0;
}
dl.sp_form dt strong
{
font-weight: bold;
}
dl.sp_form dt span
{
display: block;
}
dl.sp_form dd
{
float: left;
width: 68%;
margin: 0.5em 0 0 0;
}
dl.sp_form img, #sp_add_articles_list_header img
{
margin: 0 0.2em 0 0;
}
dl.sp_form dt a img, #sp_add_articles_list_header a img
{
position: relative;
top: 2px;
}
.sp_button_container
{
text-align: center;
padding-top: 1.5em;
}
#sp_rich_editor
{
padding-left: 2em;
padding-top: 1em;
}
#sp_text_editor
{
padding: 1em;
}
#sp_text_editor textarea
{
width: 100%;
}
#sp_text_editor input
{
float: right;
margin-right: 2px;
}

View File

@ -0,0 +1,135 @@
/* Version 2.3.5; portal_rtl */
/* ************************************* */
/* Common styles */
/* ************************************* */
.sp_right
{
text-align: left;
}
.sp_left
{
text-align: right;
}
.sp_float_left
{
float: right;
}
.sp_float_right
{
float: left;
}
/* ************************************* */
/* List styles */
/* ************************************* */
.sp_list
{
text-align: right;
padding: 0 5px 0 0;
}
.sp_list_indent
{
padding: 0 10px 0 0;
}
/* ************************************* */
/* Block specific styles */
/* ************************************* */
#sp_menu li ul
{
left: 0;
right: 75%;
}
.sp_article_icon
{
margin: 5px 0 0 10px;
}
/* ************************************* */
/* Shoutbox styles */
/* ************************************* */
.shoutbox_body
{
text-align: right;
padding: 0;
}
.shoutbox_list_compact li
{
padding: 4px 4px 4px 0;
border-bottom: 1px dashed #CCCCCC;
border-left: none;
border-right: 3px solid #DADADA;
}
.shoutbox_list_all li
{
padding: 4px 4px 0 0;
border-left: none;
border-right: 3px solid #DADADA;
}
span.shoutbox_time
{
padding-left: 0;
padding-right: 5px;
}
span.shoutbox_delete
{
float: left;
padding-right: 0;
padding-left: 3px;
}
.shoutbox_page_index
{
padding: 2px 2px 3px 0;
}
li.shoutbox_warning
{
border-left: none;
border-right: 3px solid #F66;
}
/* ************************************* */
/* Admin styles */
/* ************************************* */
#spAnnouncements
{
padding-right: 0;
padding-left: 1ex;
}
#sp_select_block_type li
{
float: right;
}
#sp_edit_block ul.sp_display_list li
{
float: right;
}
dl.sp_form
{
clear: left;
}
dl.sp_form dt
{
float: right;
}
dl.sp_form dd
{
float: right;
}
dl.sp_form img, #sp_add_articles_list_header img
{
margin: 0 0 0 0.2em;
}
#sp_rich_editor
{
padding-left: 0;
padding-right: 2em;
}
#sp_text_editor input
{
float: left;
margin-right: 0;
margin-left: 2px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

View File

@ -0,0 +1,9 @@
<?php
// Try to handle it with the upper level index.php. (it should know what to do.)
if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
include (dirname(dirname(__FILE__)) . '/index.php');
else
exit;
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Some files were not shown because too many files have changed in this diff Show More