diff --git a/Packages/SimplePortal_2.3.5.zip b/Packages/SimplePortal_2.3.5.zip new file mode 100644 index 0000000..166d945 Binary files /dev/null and b/Packages/SimplePortal_2.3.5.zip differ diff --git a/Packages/backups/2014-05-19_backup_SimplePortal_2.tar.gz b/Packages/backups/2014-05-19_backup_SimplePortal_2.tar.gz new file mode 100644 index 0000000..5b0a243 Binary files /dev/null and b/Packages/backups/2014-05-19_backup_SimplePortal_2.tar.gz differ diff --git a/Packages/backups/2014-05-19_before_SimplePortal_2.tar.gz b/Packages/backups/2014-05-19_before_SimplePortal_2.tar.gz new file mode 100644 index 0000000..7a72980 Binary files /dev/null and b/Packages/backups/2014-05-19_before_SimplePortal_2.tar.gz differ diff --git a/Packages/backups/2014-05-19_before_SimplePortal_2_2.tar.gz b/Packages/backups/2014-05-19_before_SimplePortal_2_2.tar.gz new file mode 100644 index 0000000..7a72980 Binary files /dev/null and b/Packages/backups/2014-05-19_before_SimplePortal_2_2.tar.gz differ diff --git a/Packages/installed.list b/Packages/installed.list index 5958f50..23837ff 100644 --- a/Packages/installed.list +++ b/Packages/installed.list @@ -1 +1 @@ -1392908711 \ No newline at end of file +1400527916 \ No newline at end of file diff --git a/PortalStandalone.php b/PortalStandalone.php new file mode 100644 index 0000000..f090e17 --- /dev/null +++ b/PortalStandalone.php @@ -0,0 +1,76 @@ +> "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); + +?> \ No newline at end of file diff --git a/SSI.php b/SSI.php index 8988fe3..b0e28c1 100644 --- a/SSI.php +++ b/SSI.php @@ -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(); diff --git a/Sources/Admin.php b/Sources/Admin.php index 610013c..a4eca87 100644 --- a/Sources/Admin.php +++ b/Sources/Admin.php @@ -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. diff --git a/Sources/BoardIndex.php b/Sources/BoardIndex.php index d48422e..98920ea 100644 --- a/Sources/BoardIndex.php +++ b/Sources/BoardIndex.php @@ -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. diff --git a/Sources/Display.php b/Sources/Display.php index c53df5d..cf7b531 100644 --- a/Sources/Display.php +++ b/Sources/Display.php @@ -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']; diff --git a/Sources/Help.php b/Sources/Help.php index 2896e60..ccf3f15 100644 --- a/Sources/Help.php +++ b/Sources/Help.php @@ -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') diff --git a/Sources/Load.php b/Sources/Load.php index 2bc4f41..f10b529 100644 --- a/Sources/Load.php +++ b/Sources/Load.php @@ -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) { diff --git a/Sources/ManagePermissions.php b/Sources/ManagePermissions.php index 99d258d..113175e 100644 --- a/Sources/ManagePermissions.php +++ b/Sources/ManagePermissions.php @@ -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'), diff --git a/Sources/ManageServer.php b/Sources/ManageServer.php index 9bf0226..b20d387 100644 --- a/Sources/ManageServer.php +++ b/Sources/ManageServer.php @@ -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(); diff --git a/Sources/PortalAdminArticles.php b/Sources/PortalAdminArticles.php new file mode 100644 index 0000000..8f19ad3 --- /dev/null +++ b/Sources/PortalAdminArticles.php @@ -0,0 +1,812 @@ + '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'] = '' . $context['columns'][$col]['label'] . ''; + } + + $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' => ''.$row['cname'].'', + ), + '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']) ? '' . $row['real_name'] . '' : $row['poster_name'], + ), + 'topic' => array( + 'id' => $row['id_topic'], + 'replies' => $row['num_replies'], + 'views' => $row['num_views'], + 'link' => '' . $row['subject'] . '', + ), + 'board' => array( + 'id' => $row['id_board'], + 'name' => $row['bname'], + 'link' => '' . $row['bname'] . '', + ), + 'edit' => '' . sp_embed_image('modify') . '', + 'delete' => '' . sp_embed_image('delete') . '' + ); + + 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'] . '
' . 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'] : '' . $row['poster_name'] . '' + ), + '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'); + } +} + +?> \ No newline at end of file diff --git a/Sources/PortalAdminBlocks.php b/Sources/PortalAdminBlocks.php new file mode 100644 index 0000000..469e061 --- /dev/null +++ b/Sources/PortalAdminBlocks.php @@ -0,0 +1,1060 @@ + 'sportal_admin_block_list', + 'header' => 'sportal_admin_block_list', + 'left' => 'sportal_admin_block_list', + 'top' => 'sportal_admin_block_list', + 'bottom' => 'sportal_admin_block_list', + 'right' => 'sportal_admin_block_list', + 'footer' => 'sportal_admin_block_list', + 'add' => 'sportal_admin_block_edit', + 'edit' => 'sportal_admin_block_edit', + 'delete' => 'sportal_admin_block_delete', + 'move' => 'sportal_admin_block_move', + 'statechange' => 'sportal_admin_state_change', + ); + + $_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-blocksBlocks'], + 'help' => 'sp_BlocksArea', + 'description' => $txt['sp-adminBlockListDesc'], + 'tabs' => array( + 'list' => array( + 'description' => $txt['sp-adminBlockListDesc'], + ), + 'add' => array( + 'description' => $txt['sp-adminBlockAddDesc'], + ), + 'header' => array( + 'description' => $txt['sp-adminBlockHeaderListDesc'], + ), + 'left' => array( + 'description' => $txt['sp-adminBlockLeftListDesc'], + ), + 'top' => array( + 'description' => $txt['sp-adminBlockTopListDesc'], + ), + 'bottom' => array( + 'description' => $txt['sp-adminBlockBottomListDesc'], + ), + 'right' => array( + 'description' => $txt['sp-adminBlockRightListDesc'], + ), + 'footer' => array( + 'description' => $txt['sp-adminBlockFooterListDesc'], + ), + ), + ); + + $subActions[$_REQUEST['sa']](); +} + +// Show the Block List. +function sportal_admin_block_list() +{ + global $txt, $context, $scripturl; + + // We have 4 sides... + $context['sides'] = array( + 'header' => array( + 'id' => '5', + 'name' => 'adminHeader', + 'label' => $txt['sp-positionHeader'], + 'help' => 'sp-blocksHeaderList', + ), + 'left' => array( + 'id' => '1', + 'name' => 'adminLeft', + 'label' => $txt['sp-positionLeft'], + 'help' => 'sp-blocksLeftList', + ), + 'top' => array( + 'id' => '2', + 'name' => 'adminTop', + 'label' => $txt['sp-positionTop'], + 'help' => 'sp-blocksTopList', + ), + 'bottom' => array( + 'id' => '3', + 'name' => 'adminBottom', + 'label' => $txt['sp-positionBottom'], + 'help' => 'sp-blocksBottomList', + ), + 'right' => array( + 'id' => '4', + 'name' => 'adminRight', + 'label' => $txt['sp-positionRight'], + 'help' => 'sp-blocksRightList', + ), + 'footer' => array( + 'id' => '6', + 'name' => 'adminFooter', + 'label' => $txt['sp-positionFooter'], + 'help' => 'sp-blocksFooterList', + ), + ); + + $context['block_move'] = isset($_GET['sa']) && $_GET['sa'] == 'select' && !empty($_GET['block_id']) ? (int) $_GET['block_id'] : 0; + + $sides = array('header', 'left', 'top', 'bottom', 'right', 'footer'); + // Are we viewing any of the sub lists for an individual side? + if(in_array($context['sub_action'], $sides)) + { + // Remove any sides that we don't need to show. ;) + foreach($sides as $side) + { + if($context['sub_action'] != $side) + unset($context['sides'][$side]); + } + $context['sp_blocks_single_side_list'] = true; + } + + // Columns to show. + $context['columns'] = array( + 'label' => array( + 'width' => '40%', + 'label' => $txt['sp-adminColumnName'], + 'class' => !$context['block_move'] ? 'first_th' : '', + ), + 'type' => array( + 'width' => '40%', + 'label' => $txt['sp-adminColumnType'], + ), + 'action' => array( + 'width' => '20%', + 'label' => $txt['sp-adminColumnAction'], + 'class' => 'last_th', + ), + ); + + // Get the block info for each side. + foreach($context['sides'] as $side_id => $side) + { + $context['blocks'][$side['name']] = getBlockInfo($side['id']); + foreach ($context['blocks'][$side['name']] as $block_id => $block) + { + $context['sides'][$side_id]['last'] = $block_id; + $context['blocks'][$side['name']][$block_id]['actions'] = array( + 'state_icon' => empty($block['state']) ? '' . sp_embed_image('deactive', $txt['sp-blocksActivate']) . '' : '' . sp_embed_image('active', $txt['sp-blocksDeactivate']) . '', + 'edit' => '' . sp_embed_image('modify') . '', + 'move' => '' . sp_embed_image('move', $txt['sp-adminColumnMove']) . '', + 'delete' => '' . sp_embed_image('delete') . '', + ); + + if ($context['block_move']) + { + $context['blocks'][$side['name']][$block_id]['move_insert'] = '' . sp_embed_image('arrow', $txt['sp-blocks_move_here']) . ''; + + if ($context['block_move'] == $block_id) + $context['move_title'] = sprintf($txt['sp-blocks_select_destination'], htmlspecialchars($block['label'])); + } + } + } + + // Call the sub template. + $context['sub_template'] = 'block_list'; + $context['page_title'] = $txt['sp-adminBlockListName']; +} + +// Adding or editing a block. +function sportal_admin_block_edit() +{ + global $txt, $context, $modSettings, $smcFunc, $sourcedir, $boarddir, $boards; + + // Just in case, the admin could be doing something silly like editing a SP block while SP it disabled. ;) + require_once($sourcedir . '/PortalBlocks.php'); + + $context['SPortal']['is_new'] = empty($_REQUEST['block_id']); + + // BBC Fix move the parameter to the correct position. + if (!empty($_POST['bbc_name'])) + { + $_POST['parameters'][$_POST['bbc_name']] = !empty($_POST[$_POST['bbc_parameter']]) ? $_POST[$_POST['bbc_parameter']] : ''; + // If we came from WYSIWYG then turn it back into BBC regardless. + if (!empty($_REQUEST['bbc_' . $_POST['bbc_name'] . '_mode']) && isset($_POST['parameters'][$_POST['bbc_name']])) + { + require_once($sourcedir . '/Subs-Editor.php'); + $_POST['parameters'][$_POST['bbc_name']] = html_to_bbc($_POST['parameters'][$_POST['bbc_name']]); + // We need to unhtml it now as it gets done shortly. + $_POST['parameters'][$_POST['bbc_name']] = un_htmlspecialchars($_POST['parameters'][$_POST['bbc_name']]); + // We need this for everything else. + $_POST['parameters'][$_POST['bbc_name']] = $_POST['parameters'][$_POST['bbc_name']]; + } + } + + // Passing the selected type via $_GET instead of $_POST? + $start_parameters = array(); + if (!empty($_GET['selected_type']) && empty($_POST['selected_type'])) + { + $_POST['selected_type'] = array($_GET['selected_type']); + if (!empty($_GET['parameters'])) + { + foreach ($_GET['parameters'] as $param) + { + if (isset($_GET[$param])) + $start_parameters[$param] = $_GET[$param]; + } + } + } + + if ($context['SPortal']['is_new'] && empty($_POST['selected_type']) && empty($_POST['add_block'])) + { + $context['SPortal']['block_types'] = getFunctionInfo(); + + if (!empty($_REQUEST['col'])) + $context['SPortal']['block']['column'] = $_REQUEST['col']; + + $context['sub_template'] = 'block_select_type'; + $context['page_title'] = $txt['sp-blocksAdd']; + } + elseif ($context['SPortal']['is_new'] && !empty($_POST['selected_type'])) + { + $context['SPortal']['block'] = array( + 'id' => 0, + 'label' => $txt['sp-blocksDefaultLabel'], + 'type' => $_POST['selected_type'][0], + 'type_text' => !empty($txt['sp_function_' . $_POST['selected_type'][0] . '_label']) ? $txt['sp_function_' . $_POST['selected_type'][0] . '_label'] : $txt['sp_function_unknown_label'], + 'column' => !empty($_POST['block_column']) ? $_POST['block_column'] : 0, + 'row' => 0, + 'permission_set' => 3, + 'groups_allowed' => array(), + 'groups_denied' => array(), + 'state' => 1, + 'force_view' => 0, + 'display' => '', + 'display_custom' => '', + 'style' => '', + 'parameters' => !empty($start_parameters) ? $start_parameters : array(), + 'options'=> $_POST['selected_type'][0](array(), false, true), + 'list_blocks' => !empty($_POST['block_column']) ? getBlockInfo($_POST['block_column']) : array(), + ); + } + elseif (!$context['SPortal']['is_new'] && empty($_POST['add_block'])) + { + $_REQUEST['block_id'] = (int) $_REQUEST['block_id']; + $context['SPortal']['block'] = current(getBlockInfo(null, $_REQUEST['block_id'])); + + $context['SPortal']['block'] += array( + 'options'=> $context['SPortal']['block']['type'](array(), false, true), + 'list_blocks' => getBlockInfo($context['SPortal']['block']['column']), + ); + } + + if (!empty($_POST['preview_block'])) + { + // Just in case, the admin could be doing something silly like editing a SP block while SP it disabled. ;) + require_once($boarddir . '/SSI.php'); + sportal_init_headers(); + loadTemplate('Portal'); + + $type_parameters = $_POST['block_type'](array(), 0, true); + + if (!empty($_POST['parameters']) && is_array($_POST['parameters']) && !empty($type_parameters)) + { + foreach ($type_parameters as $name => $type) + { + if (isset($_POST['parameters'][$name])) + { + if ($type == 'bbc') + { + $parameter['value'] = $_POST['parameters'][$name]; + require_once($sourcedir . '/Subs-Post.php'); + + $parameter['value'] = $smcFunc['htmlspecialchars']($parameter['value'], ENT_QUOTES); + preparsecode($parameter['value']); + + $_POST['parameters'][$name] = $parameter['value']; + } + elseif ($type == 'boards' || $type == 'board_select') + $_POST['parameters'][$name] = is_array($_POST['parameters'][$name]) ? implode('|', $_POST['parameters'][$name]) : $_POST['parameters'][$name]; + elseif ($type == 'int' || $type == 'select') + $_POST['parameters'][$name] = (int) $_POST['parameters'][$name]; + elseif ($type == 'text' || $type == 'textarea' || is_array($type)) + $_POST['parameters'][$name] = $smcFunc['htmlspecialchars']($_POST['parameters'][$name], ENT_QUOTES); + elseif ($type == 'check') + $_POST['parameters'][$name] = !empty($_POST['parameters'][$name]) ? 1 : 0; + } + } + } + else + $_POST['parameters'] = array(); + + if (empty($_POST['display_advanced'])) + { + if (!empty($_POST['display_simple']) && in_array($_POST['display_simple'], array('all', 'sportal', 'sforum', 'allaction', 'allboard', 'allpages'))) + $display = $_POST['display_simple']; + else + $display = ''; + + $custom = ''; + } + else + { + $display = array(); + $custom = array(); + + if (!empty($_POST['display_actions'])) + foreach ($_POST['display_actions'] as $action) + $display[] = $smcFunc['htmlspecialchars']($action, ENT_QUOTES); + + if (!empty($_POST['display_boards'])) + foreach ($_POST['display_boards'] as $board) + $display[] = 'b' . ((int) substr($board, 1)); + + if (!empty($_POST['display_pages'])) + foreach ($_POST['display_pages'] as $page) + $display[] = 'p' . ((int) substr($page, 1)); + + if (!empty($_POST['display_custom'])) + { + $temp = explode(',', $_POST['display_custom']); + foreach ($temp as $action) + $custom[] = $smcFunc['htmlspecialchars']($smcFunc['htmltrim']($action), ENT_QUOTES); + } + + $display = empty($display) ? '' : implode(',', $display); + $custom = empty($custom) ? '' : implode(',', $custom); + } + + $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']['block'] = array( + 'id' => $_POST['block_id'], + 'label' => $smcFunc['htmlspecialchars']($_POST['block_name'], ENT_QUOTES), + 'type' => $_POST['block_type'], + 'type_text' => !empty($txt['sp_function_' . $_POST['block_type'] . '_label']) ? $txt['sp_function_' . $_POST['block_type'] . '_label'] : $txt['sp_function_unknown_label'], + 'column' => $_POST['block_column'], + 'row' => !empty($_POST['block_row']) ? $_POST['block_row'] : 0, + 'permission_set' => $permission_set, + 'groups_allowed' => $groups_allowed, + 'groups_denied' => $groups_denied, + 'state' => !empty($_POST['block_active']), + 'force_view' => !empty($_POST['block_force']), + 'display' => $display, + 'display_custom' => $custom, + 'style' => sportal_parse_style('implode'), + 'parameters' => !empty($_POST['parameters']) ? $_POST['parameters'] : array(), + 'options'=> $_POST['block_type'](array(), false, true), + 'list_blocks' => getBlockInfo($_POST['block_column']), + 'collapsed' => false, + ); + + if (strpos($modSettings['leftwidth'], '%') !== false || strpos($modSettings['leftwidth'], 'px') !== false) + $context['widths'][1] = $modSettings['leftwidth']; + else + $context['widths'][1] = $modSettings['leftwidth'] . 'px'; + + if (strpos($modSettings['rightwidth'], '%') !== false || strpos($modSettings['rightwidth'], 'px') !== false) + $context['widths'][4] = $modSettings['rightwidth']; + else + $context['widths'][4] = $modSettings['rightwidth'] . 'px'; + + if (strpos($context['widths'][1], '%') !== false) + $context['widths'][2] = $context['widths'][3] = 100 - ($context['widths'][1] + $context['widths'][4]) . '%'; + elseif (strpos($context['widths'][1], 'px') !== false) + $context['widths'][2] = $context['widths'][3] = 960 - ($context['widths'][1] + $context['widths'][4]) . 'px'; + + if (strpos($context['widths'][1], '%') !== false) + { + $context['widths'][2] = $context['widths'][3] = 100 - ($context['widths'][1] + $context['widths'][4]) . '%'; + $context['widths'][5] = $context['widths'][6] = '100%'; + } + elseif (strpos($context['widths'][1], 'px') !== false) + { + $context['widths'][2] = $context['widths'][3] = 960 - ($context['widths'][1] + $context['widths'][4]) . 'px'; + $context['widths'][5] = $context['widths'][6] = '960px'; + } + + $context['SPortal']['preview'] = true; + } + + if (!empty($_POST['selected_type']) || !empty($_POST['preview_block']) || (!$context['SPortal']['is_new'] && empty($_POST['add_block']))) + { + if ($context['SPortal']['block']['type'] == 'sp_php' && !allowedTo('admin_forum')) + fatal_lang_error('cannot_admin_forum', false); + + $context['html_headers'] .= ' + '; + + loadLanguage('SPortalHelp', sp_languageSelect('SPortalHelp')); + + $context['SPortal']['block']['groups'] = sp_load_membergroups(); + + $context['simple_actions'] = array( + 'sportal' => $txt['sp-portal'], + 'sforum' => $txt['sp-forum'], + 'allaction' => $txt['sp-blocksOptionAllActions'], + 'allboard' => $txt['sp-blocksOptionAllBoards'], + 'allpages' => $txt['sp-blocksOptionAllPages'], + 'all' => $txt['sp-blocksOptionEverywhere'], + ); + + $context['display_actions'] = array( + 'portal' => $txt['sp-portal'], + 'forum' => $txt['sp-forum'], + 'recent' => $txt['recent_posts'], + 'unread' => $txt['unread_topics_visit'], + 'unreadreplies' => $txt['unread_replies'], + 'profile' => $txt['profile'], + 'pm' => $txt['pm_short'], + 'calendar' => $txt['calendar'], + 'admin' => $txt['admin'], + 'login' => $txt['login'], + 'register' => $txt['register'], + 'post' => $txt['post'], + 'stats' => $txt['forum_stats'], + 'search' => $txt['search'], + 'mlist' => $txt['members_list'], + 'moderate' => $txt['moderate'], + 'help' => $txt['help'], + 'who' => $txt['who_title'], + ); + + $request = $smcFunc['db_query']('',' + SELECT id_board, name + FROM {db_prefix}boards + ORDER BY name DESC' + ); + $context['display_boards'] = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + $context['display_boards']['b' . $row['id_board']] = $row['name']; + $smcFunc['db_free_result']($request); + + $request = $smcFunc['db_query']('',' + SELECT id_page, title + FROM {db_prefix}sp_pages + ORDER BY title DESC' + ); + $context['display_pages'] = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + $context['display_pages']['p' . $row['id_page']] = $row['title']; + $smcFunc['db_free_result']($request); + + if (empty($context['SPortal']['block']['display'])) + $context['SPortal']['block']['display'] = array('0'); + else + $context['SPortal']['block']['display'] = explode(',', $context['SPortal']['block']['display']); + + if (in_array($context['SPortal']['block']['display'][0], array('all', 'sportal', 'sforum', 'allaction', 'allboard', 'allpages')) || $context['SPortal']['is_new'] || empty($context['SPortal']['block']['display'][0]) && empty($context['SPortal']['block']['display_custom'])) + $context['SPortal']['block']['display_type'] = 0; + else + $context['SPortal']['block']['display_type'] = 1; + + $context['SPortal']['block']['style'] = sportal_parse_style('explode', $context['SPortal']['block']['style'], !empty($context['SPortal']['preview'])); + + // Prepare the Textcontent for BBC, only the first bbc will be correct detected! (SMF Support only 1 per page with the standard function) + $firstBBCFound = false; + foreach ($context['SPortal']['block']['options'] as $name => $type) + { + // Selectable Boards :D + if ($type == 'board_select' || $type == 'boards') + { + if (empty($boards)) + { + require_once($sourcedir.'/Subs-Boards.php'); + getBoardTree(); + } + + // Merge the array ;). (Only in 2.0 needed) + if(!isset($context['SPortal']['block']['parameters'][$name])) + $context['SPortal']['block']['parameters'][$name] = array(); + elseif(!empty($context['SPortal']['block']['parameters'][$name]) && is_array($context['SPortal']['block']['parameters'][$name])) + $context['SPortal']['block']['parameters'][$name] = implode('|', $context['SPortal']['block']['parameters'][$name]); + + $context['SPortal']['block']['board_options'][$name] = array(); + $config_variable = !empty($context['SPortal']['block']['parameters'][$name]) ? $context['SPortal']['block']['parameters'][$name] : array(); + $config_variable = !is_array($config_variable) ? explode('|', $config_variable) : $config_variable; + $context['SPortal']['block']['board_options'][$name] = array(); + + // Create the list for this Item + foreach ($boards as $board) + { + if (!empty($board['redirect'])) // Ignore the redirected boards :) + continue; + + $context['SPortal']['block']['board_options'][$name][$board['id']] = array( + 'value' => $board['id'], + 'text' => $board['name'], + 'selected' => in_array($board['id'], $config_variable), + ); + } + } + // Prepare the Textcontent for BBC, only the first bbc will be correct detected! (SMF Support only 1 per page with the standard function) + elseif ($type == 'bbc') + { + // SMF support only one bbc correct, multiple bbc do not work at the moment + if(!$firstBBCFound) + { + $firstBBCFound = true; + // Start SMF BBC Sytem :) + require_once($sourcedir . '/Subs-Editor.php'); + // Prepare the output :D + $form_message = !empty($context['SPortal']['block']['parameters'][$name]) ? $context['SPortal']['block']['parameters'][$name] : ''; + // But if it's in HTML world, turn them into htmlspecialchar's so they can be edited! + if (strpos($form_message, '[html]') !== false) + { + $parts = preg_split('~(\[/code\]|\[code(?:=[^\]]+)?\])~i', $form_message, -1, PREG_SPLIT_DELIM_CAPTURE); + for ($i = 0, $n = count($parts); $i < $n; $i++) + { + // It goes 0 = outside, 1 = begin tag, 2 = inside, 3 = close tag, repeat. + if ($i % 4 == 0) + $parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ise', '\'[html]\' . preg_replace(\'~~i\', \'<br />
\', \'$1\') . \'[/html]\'', $parts[$i]); + } + $form_message = implode('', $parts); + } + $form_message = preg_replace('~~i', "\n", $form_message); + + // Prepare the data before i want them inside the textarea + $form_message = str_replace(array('"', '<', '>', ' '), array('"', '<', '>', ' '), $form_message); + $context['SPortal']['bbc'] = 'bbc_'.$name; + $message_data = array( + 'id' => $context['SPortal']['bbc'], + 'width' => '95%', + 'height' => '200px', + 'value' => $form_message, + 'form' => 'sp_block', + ); + + // Run the SMF bbc editor rutine + create_control_richedit($message_data); + + // Store the updated data on the parameters + $context['SPortal']['block']['parameters'][$name] = $form_message; + } + else + $context['SPortal']['block']['options'][$name] = 'textarea'; + } + } + + $context['sub_template'] = 'block_edit'; + $context['page_title'] = $context['SPortal']['is_new'] ? $txt['sp-blocksAdd'] : $txt['sp-blocksEdit']; + } + + if (!empty($_POST['add_block'])) + { + if ($_POST['block_type'] == 'sp_php' && !allowedTo('admin_forum')) + fatal_lang_error('cannot_admin_forum', false); + + if (!isset($_POST['block_name']) || $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['block_name']), ENT_QUOTES) === '') + fatal_lang_error('error_sp_name_empty', false); + + if ($_POST['block_type'] == 'sp_php' && !empty($_POST['parameters']['content']) && empty($modSettings['sp_disable_php_validation'])) + { + $error = sp_validate_php($_POST['parameters']['content']); + + if ($error) + fatal_lang_error('error_sp_php_' . $error, false); + } + + if (!empty($_REQUEST['block_id'])) + $current_data = current(getBlockInfo(null, $_REQUEST['block_id'])); + + if (!empty($_POST['placement']) && (($_POST['placement'] == 'before') || ($_POST['placement'] == 'after'))) + { + if (!empty($current_data)) + $current_row = $current_data['row']; + else + $current_row = null; + + if ($_POST['placement'] == 'before') + $row = (int) $_POST['block_row']; + else + $row = (int) $_POST['block_row'] + 1; + + if (!empty($current_row) && ($row > $current_row)) + { + $row = $row - 1; + + $smcFunc['db_query']('', ' + UPDATE {db_prefix}sp_blocks + SET row = row - 1 + WHERE col = {int:col} + AND row > {int:start} + AND row <= {int:end}', + array( + 'col' => (int) $_POST['block_column'], + 'start' => $current_row, + 'end' => $row, + ) + ); + } + else + { + $smcFunc['db_query']('', ' + UPDATE {db_prefix}sp_blocks + SET row = row + 1 + WHERE col = {int:col} + AND row >= {int:start}' . (!empty($current_row) ? ' + AND row < {int:end}' : ''), + array( + 'col' => (int) $_POST['block_column'], + 'start' => $row, + 'end' => !empty($current_row) ? $current_row : 0, + ) + ); + } + } + elseif (!empty($_POST['placement']) && $_POST['placement'] == 'nochange') + $row = 0; + else + { + $request = $smcFunc['db_query']('',' + SELECT row + FROM {db_prefix}sp_blocks + WHERE col = {int:col}' . (!empty($_REQUEST['block_id']) ? ' + AND id_block != {int:current_id}' : '' ) . ' + ORDER BY row DESC + LIMIT 1', + array( + 'col' => $_POST['block_column'], + 'current_id' => $_REQUEST['block_id'], + ) + ); + list ($row) = $smcFunc['db_fetch_row']($request); + $smcFunc['db_free_result']($request); + + $row = $row + 1; + } + + $type_parameters = $_POST['block_type'](array(), 0, true); + + if (!empty($_POST['parameters']) && is_array($_POST['parameters']) && !empty($type_parameters)) + { + foreach ($type_parameters as $name => $type) + { + if (isset($_POST['parameters'][$name])) + { + // Prepare BBC Content for SMF 2 special case =D + if ($type == 'bbc') + { + $parameter['value'] = $_POST['parameters'][$name]; + require_once($sourcedir . '/Subs-Post.php'); + // Prepare the message a bit for some additional testing. + $parameter['value'] = $smcFunc['htmlspecialchars']($parameter['value'], ENT_QUOTES); + preparsecode($parameter['value']); + //Store now the correct and fixed value ;) + $_POST['parameters'][$name] = $parameter['value']; + } + elseif ($type == 'boards' || $type == 'board_select') + $_POST['parameters'][$name] = is_array($_POST['parameters'][$name]) ? implode('|', $_POST['parameters'][$name]) : $_POST['parameters'][$name]; + elseif ($type == 'int' || $type == 'select') + $_POST['parameters'][$name] = (int) $_POST['parameters'][$name]; + elseif ($type == 'text' || $type == 'textarea' || is_array($type)) + $_POST['parameters'][$name] = $smcFunc['htmlspecialchars']($_POST['parameters'][$name], ENT_QUOTES); + elseif ($type == 'check') + $_POST['parameters'][$name] = !empty($_POST['parameters'][$name]) ? 1 : 0; + } + } + } + else + $_POST['parameters'] = array(); + + $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['display_advanced'])) + { + if (!empty($_POST['display_simple']) && in_array($_POST['display_simple'], array('all', 'sportal', 'sforum', 'allaction', 'allboard', 'allpages'))) + $display = $_POST['display_simple']; + else + $display = ''; + + $custom = ''; + } + else + { + $display = array(); + + if (!empty($_POST['display_actions'])) + foreach ($_POST['display_actions'] as $action) + $display[] = $smcFunc['htmlspecialchars']($action, ENT_QUOTES); + + if (!empty($_POST['display_boards'])) + foreach ($_POST['display_boards'] as $board) + $display[] = 'b' . ((int) substr($board, 1)); + + if (!empty($_POST['display_pages'])) + foreach ($_POST['display_pages'] as $page) + $display[] = 'p' . ((int) substr($page, 1)); + + if (!empty($_POST['display_custom'])) + { + $temp = explode(',', $_POST['display_custom']); + foreach ($temp as $action) + $custom[] = $smcFunc['htmlspecialchars']($smcFunc['htmltrim']($action), ENT_QUOTES); + } + + $display = empty($display) ? '' : implode(',', $display); + + if (!allowedTo('admin_forum') && isset($current_data['display_custom']) && substr($current_data['display_custom'], 0, 4) === '$php') + $custom = $current_data['display_custom']; + elseif (!empty($_POST['display_custom'])) + { + if (allowedTo('admin_forum') && substr($_POST['display_custom'], 0, 4) === '$php') + $custom = $smcFunc['htmlspecialchars']($_POST['display_custom'], ENT_QUOTES); + else + { + $custom = array(); + $temp = explode(',', $_POST['display_custom']); + + foreach ($temp as $action) + $custom[] = $smcFunc['htmlspecialchars']($action, ENT_QUOTES); + + $custom = empty($custom) ? '' : implode(',', $custom); + } + } + else + $custom = ''; + } + + $blockInfo = array( + 'id' => (int) $_POST['block_id'], + 'label' => $smcFunc['htmlspecialchars']($_POST['block_name'], ENT_QUOTES), + 'type' => $_POST['block_type'], + 'col' => $_POST['block_column'], + 'row' => $row, + 'permission_set' => $permission_set, + 'groups_allowed' => $groups_allowed, + 'groups_denied' => $groups_denied, + 'state' => !empty($_POST['block_active']) ? 1 : 0, + 'force_view' => !empty($_POST['block_force']) ? 1 : 0, + 'display' => $display, + 'display_custom' => $custom, + 'style' => sportal_parse_style('implode'), + ); + + if ($context['SPortal']['is_new']) + { + unset($blockInfo['id']); + + $smcFunc['db_insert']('', + '{db_prefix}sp_blocks', + array( + 'label' => 'string', + 'type' => 'string', + 'col' => 'int', + 'row' => 'int', + 'permission_set' => 'int', + 'groups_allowed' => 'string', + 'groups_denied' => 'string', + 'state' => 'int', + 'force_view' => 'int', + 'display' => 'string', + 'display_custom' => 'string', + 'style' => 'string', + ), + $blockInfo, + array('id_block') + ); + + $blockInfo['id'] = $smcFunc['db_insert_id']('{db_prefix}sp_blocks', 'id_block'); + } + else + { + $block_fields = array( + "label = {string:label}", + "permission_set = {int:permission_set}", + "groups_allowed = {string:groups_allowed}", + "groups_denied = {string:groups_denied}", + "state = {int:state}", + "force_view = {int:force_view}", + "display = {string:display}", + "display_custom = {string:display_custom}", + "style = {string:style}", + ); + + if (!empty($blockInfo['row'])) + $block_fields[] = "row = {int:row}"; + else + unset($blockInfo['row']); + + $smcFunc['db_query']('',' + UPDATE {db_prefix}sp_blocks + SET ' . implode(', ', $block_fields) . ' + WHERE id_block = {int:id}', + $blockInfo + ); + + $smcFunc['db_query']('',' + DELETE FROM {db_prefix}sp_parameters + WHERE id_block = {int:id}', + array( + 'id' => $blockInfo['id'], + ) + ); + } + + if (!empty($_POST['parameters'])) + { + $parameters = array(); + foreach ($_POST['parameters'] as $variable => $value) + $parameters[] = array( + 'id_block' => $blockInfo['id'], + 'variable' => $variable, + 'value' => $value, + ); + + $smcFunc['db_insert']('', + '{db_prefix}sp_parameters', + array( + 'id_block' => 'int', + 'variable' => 'string', + 'value' => 'string', + ), + $parameters, + array() + ); + } + + redirectexit('action=admin;area=portalblocks'); + } +} + +// Function for moving a block. +function sportal_admin_block_move() +{ + global $smcFunc; + + checkSession('get'); + + if (empty($_REQUEST['block_id'])) + fatal_lang_error('error_sp_id_empty', false); + else + $block_id = (int) $_REQUEST['block_id']; + + if (empty($_REQUEST['col']) || $_REQUEST['col'] < 1 || $_REQUEST['col'] > 6) + fatal_lang_error('error_sp_side_wrong', false); + else + $target_side = (int) $_REQUEST['col']; + + if (empty($_REQUEST['row'])) + { + $request = $smcFunc['db_query']('',' + SELECT MAX(row) + FROM {db_prefix}sp_blocks + WHERE col = {int:target_side} + LIMIT {int:limit}', + array( + 'target_side' => $target_side, + 'limit' => 1, + ) + ); + list ($target_row) = $smcFunc['db_fetch_row']($request); + $smcFunc['db_free_result']($request); + + $target_row += 1; + } + else + $target_row = (int) $_REQUEST['row']; + + $request = $smcFunc['db_query']('',' + SELECT col, row + FROM {db_prefix}sp_blocks + WHERE id_block = {int:block_id} + LIMIT {int:limit}', + array( + 'block_id' => $block_id, + 'limit' => 1, + ) + ); + list ($current_side, $current_row) = $smcFunc['db_fetch_row']($request); + $smcFunc['db_free_result']($request); + + if ($current_side != $target_side || $current_row + 1 != $target_row) + { + if ($current_side != $target_side) + { + $current_row = 100; + $smcFunc['db_query']('',' + UPDATE {db_prefix}sp_blocks + SET col = {int:target_side}, row = {int:temp_row} + WHERE id_block = {int:block_id}', + array( + 'target_side' => $target_side, + 'temp_row' => $current_row, + 'block_id' => $block_id, + ) + ); + } + + $smcFunc['db_query']('',' + UPDATE {db_prefix}sp_blocks + SET row = row + 1 + WHERE col = {int:target_side} + AND row >= {int:target_row}', + array( + 'target_side' => $target_side, + 'target_row' => $target_row, + ) + ); + + $smcFunc['db_query']('',' + UPDATE {db_prefix}sp_blocks + SET row = {int:target_row} + WHERE id_block = {int:block_id}', + array( + 'target_row' => $target_row, + 'block_id' => $block_id, + ) + ); + + foreach (array_unique(array($current_side, $target_side)) as $side) + fixColumnRows($side); + } + + redirectexit('action=admin;area=portalblocks'); +} + +// Function for deleting a block. +function sportal_admin_block_delete() +{ + global $smcFunc; + + // Check if he can? + checkSession('get'); + + // Make sure ID is an integer. + $_REQUEST['block_id'] = (int) $_REQUEST['block_id']; + + // Do we have that? + if(empty($_REQUEST['block_id'])) + fatal_lang_error('error_sp_id_empty', false); + + // Make sure column ID is an integer too. + $_REQUEST['col'] = (int) $_REQUEST['col']; + + // Only Admins can Remove PHP Blocks + if(!allowedTo('admin_forum')) + { + $context['SPortal']['block'] = current(getBlockInfo(null, $_REQUEST['block_id'])); + if($context['SPortal']['block']['type'] == 'sp_php' && !allowedTo('admin_forum')) + fatal_lang_error('cannot_admin_forum', false); + } + + // We don't need it anymore. + $smcFunc['db_query']('',' + DELETE FROM {db_prefix}sp_blocks + WHERE id_block = {int:id}', + array( + 'id' => $_REQUEST['block_id'], + ) + ); + + $smcFunc['db_query']('',' + DELETE FROM {db_prefix}sp_parameters + WHERE id_block = {int:id}', + array( + 'id' => $_REQUEST['block_id'], + ) + ); + + // Fix column rows. + fixColumnRows($_REQUEST['col']); + + // Return back to the block list. + redirectexit('action=admin;area=portalblocks'); +} + +?> \ No newline at end of file diff --git a/Sources/PortalAdminMain.php b/Sources/PortalAdminMain.php new file mode 100644 index 0000000..f1a0814 --- /dev/null +++ b/Sources/PortalAdminMain.php @@ -0,0 +1,348 @@ + '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( + 'Selman "[SiNaN]" Eser', + 'ディン1031', + 'Nathaniel Baxter', + ), + ), + array( + 'title' => $txt['sp-info_groups_support'], + 'members' => array( + 'AngelinaBelle', + ), + ), + array( + 'title' => $txt['sp-info_groups_customize'], + 'members' => array( + 'Robbo', + 'Berat "grafitus" Doğan', + 'Blue', + ), + ), + array( + 'title' => $txt['sp-info_groups_language'], + 'members' => array( + 'Jade "Alundra" Elizabeth', + '130860', + ), + ), + array( + 'title' => $txt['sp-info_groups_marketing'], + 'members' => array( + 'Runic', + ), + ), + array( + 'title' => $txt['sp-info_groups_beta'], + 'members' => array( + 'Özgü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'][] = '' . $user_profile[$member]['real_name'] . ''; + } + + $context['sub_template'] = 'information'; + $context['page_title'] = $txt['sp-info_title']; +} + +?> \ No newline at end of file diff --git a/Sources/PortalAdminPages.php b/Sources/PortalAdminPages.php new file mode 100644 index 0000000..d06f205 --- /dev/null +++ b/Sources/PortalAdminPages.php @@ -0,0 +1,635 @@ + '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'] = '' . $context['columns'][$col]['label'] . ''; + } + + $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' => '' . $row['title'] . '', + 'type' => $row['type'], + 'type_text' => $txt['sp_pages_type_'. $row['type']], + 'views' => $row['views'], + 'status' => $row['status'], + 'status_image' => '' . sp_embed_image(empty($row['status']) ? 'deactive' : 'active', $txt['sp_admin_pages_' . (!empty($row['status']) ? 'de' : '') . 'activate']) . '', + 'actions' => array( + 'edit' => '' . sp_embed_image('modify') . '', + 'delete' => '' . sp_embed_image('delete') . '', + ) + ); + } + $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('"', '<', '>', ' '), array('"', '<', '>', ' '), 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'); +} + +?> \ No newline at end of file diff --git a/Sources/PortalAdminShoutbox.php b/Sources/PortalAdminShoutbox.php new file mode 100644 index 0000000..38bf239 --- /dev/null +++ b/Sources/PortalAdminShoutbox.php @@ -0,0 +1,589 @@ + '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'] = '' . $context['columns'][$col]['label'] . ''; + } + + $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' => '' . sp_embed_image(empty($row['status']) ? 'deactive' : 'active', $txt['sp_admin_shoutbox_' . (!empty($row['status']) ? 'de' : '') . 'activate']) . '', + 'actions' => array( + 'edit' => '' . sp_embed_image('modify') . '', + 'prune' => '' . sp_embed_image('bin') . '', + 'delete' => '' . sp_embed_image('delete') . '', + ) + ); + } + $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('\'' => ''')), + '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'; +} + +?> \ No newline at end of file diff --git a/Sources/PortalArticles.php b/Sources/PortalArticles.php new file mode 100644 index 0000000..3a9427d --- /dev/null +++ b/Sources/PortalArticles.php @@ -0,0 +1,325 @@ + 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'] .= '...'; + + 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']) ? '' : '| ' . $txt['ssi_write_comment'] . '', + 'new_comment' => !empty($row['locked']) ? '' : '| ' . $txt['ssi_write_comment'] . '', + 'link' => '' . $txt['sp-read_more'] . '', + 'approved' => $row['approved'], + ), + 'category' => array( + 'id' => $row['id_category'], + 'name' => $row['cname'], + 'picture' => array ( + 'href' => $row['picture'], + 'image' => '' . $row['cname'] . '', + ), + ), + 'message' => array( + 'id' => $row['id_message'], + 'icon' => '' . $row['icon'] . '', + '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'] : '' . $row['poster_name'] . '') : $row['poster_name'], + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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' => '' . $row['subject'] . '', + 'locked' => !empty($row['locked']), + ), + 'board' => array( + 'id' => $row['id_board'], + 'name' => $row['bname'], + 'link' => '' . $row['bname'] . '', + ), + ); + + 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'] . '
' . 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); +} + +?> \ No newline at end of file diff --git a/Sources/PortalBlocks.php b/Sources/PortalBlocks.php new file mode 100644 index 0000000..8dfa76f --- /dev/null +++ b/Sources/PortalBlocks.php @@ -0,0 +1,3564 @@ +'; + + if ($context['user']['is_guest']) + { + echo ' + +
+ + + + + + + + + + + +
 
 
+ +
+ +
', sprintf($txt['welcome_guest'], $txt['guest_title']); + } + else + { + loadMemberData($user_info['id']); + loadMemberContext($user_info['id'], true); + + $member_info = $memberContext[$user_info['id']]; + + if (sp_loadColors($member_info['id']) !== false) + $member_info['colored_name'] = $color_profile[$member_info['id']]['colored_name']; + + $member_info['karma']['total'] = $member_info['karma']['good'] - $member_info['karma']['bad']; + + echo ' + ', strtolower($member_info['name']) === 'okarin' ? 'Okae-Rin, ' : $txt['hello_member'], ' ', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], ' +

'; + + if (!empty($member_info['avatar']['image'])) + echo ' + ', $member_info['avatar']['image'], '

'; + + if (!empty($member_info['group'])) + echo ' + ', $member_info['group'], '
'; + else + echo ' + ', $member_info['post_group'], '
'; + + echo ' + ', $member_info['group_stars'], '
'; + + echo ' +
+ +
'; + + echo ' + ', sp_embed_image('arrow'), ' ', $txt['profile'], ' ', sp_embed_image('arrow'), ' ', $txt['logout'], ''; + } + + echo ' + '; +} + +function sp_latestMember($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $context, $scripturl, $txt, $color_profile; + + $block_parameters = array( + 'limit' => 'int', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; + + $request = $smcFunc['db_query']('',' + SELECT id_member, real_name, date_registered + FROM {db_prefix}members + WHERE is_activated = {int:is_activated} + ORDER BY id_member DESC + LIMIT {int:limit}', + array( + 'is_activated' => 1, + 'limit' => $limit, + ) + ); + $members = array(); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($row['id_member'])) + $colorids[$row['id_member']] = $row['id_member']; + + $members[] = array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], + 'link' => '' . $row['real_name'] . '', + 'date' => timeformat($row['date_registered'], '%d %b'), + ); + } + $smcFunc['db_free_result']($request); + + if (empty($members)) + { + echo ' + ', $txt['error_sp_no_members_found']; + return; + } + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($members as $k => $p) + { + if (!empty($color_profile[$p['id']]['link'])) + $members[$k]['link'] = $color_profile[$p['id']]['link']; + } + } + + echo ' + '; +} + +function sp_whosOnline($parameters, $id, $return_parameters = false) +{ + global $scripturl, $sourcedir, $modSettings, $txt; + + $block_parameters = array( + 'online_today' => 'check' + ); + + if ($return_parameters) + return $block_parameters; + + $online_today = !empty($parameters['online_today']); + + $stats = ssi_whosOnline('array'); + + echo ' + +
+
    '; + + foreach ($stats['users_online'] as $user) + echo ' +
  • ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ($user['name'] == 'Blue' && ($user['link'] = str_replace('>Blue<', '>Purple<', $user['link'])) ? '' : ''), ' ', $user['hidden'] ? '' . $user['link'] . '' : $user['link'], '
  • '; + + echo ' +
+
'; + } + else + { + echo ' + +
+
', $txt['error_sp_no_online'], '
'; + } + + if ($online_today && file_exists($sourcedir . '/Subs-MembersOnlineToday.php')) + { + require_once($sourcedir . '/Subs-MembersOnlineToday.php'); + + $membersOnlineTodayOptions = array( + 'sort' => 'login_time', + 'reverse_sort' => true, + 'period' => 'current_day', + 'canview' => 'registered', + ); + + $stats += getMembersOnlineTodayStats($membersOnlineTodayOptions); + + if (empty($stats['num_users_online_today'])) + return; + + echo ' + +
+
    '; + + foreach ($stats['users_online_today'] as $user) + echo ' +
  • ', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $user['hidden'] ? '' . $user['link'] . '' : $user['link'], '
  • '; + + echo ' +
+
'; + } +} + +function sp_boardStats($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $scripturl, $modSettings, $txt; + + $block_parameters = array( + 'averages' => 'check', + ); + + if ($return_parameters) + return $block_parameters; + + $averages = !empty($parameters['averages']) ? 1 : 0; + + loadLanguage('Stats'); + + $totals = ssi_boardStats('array'); + + if ($averages) + { + $result = $smcFunc['db_query']('', ' + SELECT + SUM(posts) AS posts, SUM(topics) AS topics, SUM(registers) AS registers, + SUM(most_on) AS most_on, MIN(date) AS date, SUM(hits) AS hits + FROM {db_prefix}log_activity', + array( + ) + ); + $row = $smcFunc['db_fetch_assoc']($result); + $smcFunc['db_free_result']($result); + + $total_days_up = ceil((time() - strtotime($row['date'])) / (60 * 60 * 24)); + + $totals['average_posts'] = comma_format(round($row['posts'] / $total_days_up, 2)); + $totals['average_topics'] = comma_format(round($row['topics'] / $total_days_up, 2)); + $totals['average_members'] = comma_format(round($row['registers'] / $total_days_up, 2)); + $totals['average_online'] = comma_format(round($row['most_on'] / $total_days_up, 2)); + } + + echo ' + '; + + if ($averages) + { + echo ' +
+ '; + } +} + +function sp_topPoster($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $context, $scripturl, $modSettings, $txt, $color_profile; + + $block_parameters = array( + 'limit' => 'int', + 'type' => 'select', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; + $type = !empty($parameters['type']) ? (int) $parameters['type'] : 0; + + if (!empty($type)) + { + if ($type == 1) + { + list($year, $month, $day) = explode('-', date('Y-m-d')); + $start_time = mktime(0, 0, 0, $month, $day, $year); + } + elseif ($type == 2) + $start_time = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (date("N") * 3600 * 24); + elseif ($type == 3) + { + $months = array( 1 => 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); + $start_time = mktime(0, 0, 0, date("n"), date("j"), date("Y")) - (3600 * 24 * $months[(int) date("m", time())]); + } + + $start_time = forum_time(false, $start_time); + + $request = $smcFunc['db_query']('', ' + SELECT + mem.id_member, mem.real_name, COUNT(*) as posts, + mem.avatar, a.id_attach, a.attachment_type, a.filename + FROM {db_prefix}messages AS m + LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) + LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) + WHERE m.poster_time > {int:start_time} + AND m.id_member != 0 + GROUP BY mem.id_member + ORDER BY posts DESC + LIMIT {int:limit}', + array( + 'start_time' => $start_time, + 'limit' => $limit, + ) + ); + } + else + { + $request = $smcFunc['db_query']('',' + SELECT + m.id_member, m.real_name, m.posts, m.avatar, + a.id_attach, a.attachment_type, a.filename + FROM {db_prefix}members AS m + LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member) + ORDER BY posts DESC + LIMIT {int:limit}', + array( + 'limit' => $limit, + ) + ); + } + $members = array(); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($row['id_member'])) + $colorids[$row['id_member']] = $row['id_member']; + + 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 = ''; + } + + $members[] = array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], + 'link' => '' . $row['real_name'] . '', + 'posts' => comma_format($row['posts']), + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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']) + ), + ); + } + $smcFunc['db_free_result']($request); + + if (empty($members)) + { + echo ' + ', $txt['error_sp_no_members_found']; + return; + } + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($members as $k => $p) + { + if (!empty($color_profile[$p['id']]['link'])) + $members[$k]['link'] = $color_profile[$p['id']]['link']; + } + } + + echo ' + '; + + foreach ($members as $member) + echo ' + + + + '; + + echo ' +
', !empty($member['avatar']['href']) ? ' + ' . $member['name'] . '' : '', ' + + ', $member['link'], '
+ ', $member['posts'], ' ', $txt['posts'], ' +
'; +} + +function sp_topStatsMember($parameters, $id, $return_parameters = false) +{ + global $context, $settings, $txt, $scripturl, $user_info, $user_info, $modSettings, $boards, $color_profile; + global $smcFunc, $sourcedir, $boarddir, $themedir; + static $sp_topStatsSystem; + + $block_parameters = array( + 'type' => array( + '0' => $txt['sp_topStatsMember_total_time_logged_in'], + '1' => $txt['sp_topStatsMember_Posts'], + '2' => $txt['sp_topStatsMember_Karma_Good'], + '3' => $txt['sp_topStatsMember_Karma_Bad'], + '4' => $txt['sp_topStatsMember_Karma_Total'], + '5' => $txt['sp_topStatsMember_Thank-O-Matic_Top_Given'], + '6' => $txt['sp_topStatsMember_Thank-O-Matic_Top_Recived'], + '10' => $txt['sp_topStatsMember_Advanced_Reputation_System_Best'], + '11' => $txt['sp_topStatsMember_Advanced_Reputation_System_Worst'], + 'sa_shop_money' => $txt['sp_topStatsMember_SA_Shop_Cash'], + 'sa_shop_trades' => $txt['sp_topStatsMember_SA_Shop_Trades'], + 'sa_shop_purchase' => $txt['sp_topStatsMember_SA_Shop_Purchase'], + 'casino' => $txt['sp_topStatsMember_Casino'], + ), + 'limit' => 'int', + 'sort_asc' => 'check', + 'last_active_limit' => 'int', + 'enable_label' => 'check', + 'list_label' => 'text', + ); + + if ($return_parameters) + return $block_parameters; + + if (empty($sp_topStatsSystem)) + { + /* + The system setup array, order depend on the $txt array of the select + name + It's for better knowing what this option can do. + mod_id + Only as information + field + The members field that should be loaded + Please don't forget to add mem. before the field names + (That what is after the SELECT Statment) + order + What is the field name i need to be sort after + where + Here you can add additional where statments :) + output_text + What should be outputed after the avatar and nickname + For example if you field is karmaGood + 'output' => $txt['karma'] . '%karmaGood%'; + output_function + With this you can add to the $row of the query some infomartions. + reverse + On true it change the reverse cause, if not set it will be false :) + enabled + true = mod exists or is possible to use :D + + 'error_msg' => $txt['my_error_msg'];; You can insert here what kind of error message should appear if the modification not exists =D + */ + $sp_topStatsSystem = array( + '0' => array( + 'name' => 'Total time logged in', + 'field' => 'mem.total_time_logged_in', + 'order' => 'mem.total_time_logged_in', + 'output_function' => create_function('&$row', ' + global $txt; + // Figure out the days, hours and minutes. + $timeDays = floor($row["total_time_logged_in"] / 86400); + $timeHours = floor(($row["total_time_logged_in"] % 86400) / 3600); + + // Figure out which things to show... (days, hours, minutes, etc.) + $timelogged = ""; + if ($timeDays > 0) + $timelogged .= $timeDays . $txt["totalTimeLogged5"]; + if ($timeHours > 0) + $timelogged .= $timeHours . $txt["totalTimeLogged6"]; + $timelogged .= floor(($row["total_time_logged_in"] % 3600) / 60) . $txt["totalTimeLogged7"]; + $row["timelogged"] = $timelogged; + '), + 'output_text' => ' %timelogged%', + 'reverse_sort_asc' => false, + 'enabled' => true, + ), + '1' => array( + 'name' => 'Posts', + 'field' => 'mem.posts', + 'order' => 'mem.posts', + 'output_text' => ' %posts% '. $txt['posts'], + 'enabled' => true, + ), + '2' => array( + 'name' => 'Karma Good', + 'field' => 'mem.karma_good, mem.karma_bad', + 'order' => 'mem.karma_good', + 'output_function' => create_function('&$row', ' + $row["karma_total"] = $row["karma_good"] - $row["karma_bad"]; + '), + 'output_text' => $modSettings['karmaLabel'] . ($modSettings['karmaMode'] == 1 ? ' %karma_total%' : ' +%karma_good%\-%karma_bad%'), + 'enabled' => !empty($modSettings['karmaMode']), + 'error_msg' => $txt['sp_karma_is_disabled'], + ), + '3' => array( + 'name' => 'Karma Bad', + 'field' => 'mem.karma_good, mem.karma_bad', + 'order' => 'mem.karma_bad', + 'output_function' => create_function('&$row', ' + $row["karma_total"] = $row["karma_good"] - $row["karma_bad"]; + '), + 'output_text' => $modSettings['karmaLabel'] . ($modSettings['karmaMode'] == 1 ? ' %karma_total%' : ' +%karma_good%\-%karma_bad%'), + 'enabled' => !empty($modSettings['karmaMode']), + 'error_msg' => $txt['sp_karma_is_disabled'], + ), + '4' => array( + 'name' => 'Karma Total', + 'field' => 'mem.karma_good, mem.karma_bad', + 'order' => 'FLOOR(1000000+karma_good-karma_bad)', + 'output_function' => create_function('&$row', ' + $row["karma_total"] = $row["karma_good"] - $row["karma_bad"]; + '), + 'output_text' => $modSettings['karmaLabel'] . ($modSettings['karmaMode'] == 1 ? ' %karma_total%' : ' +%karma_good%\-%karma_bad%'), + 'enabled' => !empty($modSettings['karmaMode']), + 'error_msg' => $txt['sp_karma_is_disabled'], + ), + '5' => array( + 'name' => 'Thank-O-Matic Top Given', + 'mod_id' => 710, + 'field' => 'mem.thank_you_post_made, mem.thank_you_post_became', + 'order' => 'mem.thank_you_post_made', + 'output_text' => '%thank_you_post_made% ' . (!empty($txt['thank_you_post_made_display']) ? $txt['thank_you_post_thx_display'] . ' ' . $txt['thank_you_post_made_display'] : ''), + 'enabled' => file_exists($sourcedir . '/ThankYouPost.php'), + 'error_msg' => $txt['sp_thankomatic_no_exist'], + ), + '6' => array( + 'name' => 'Thank-O-Matic Top Recived', + 'mod_id' => 710, + 'field' => 'mem.thank_you_post_made, mem.thank_you_post_became', + 'order' => 'mem.thank_you_post_became', + 'output_text' => '%thank_you_post_became% ' . (!empty($txt['thank_you_post_became_display']) ? $txt['thank_you_post_thx_display'] . ' ' . $txt['thank_you_post_became_display'] : ''), + 'enabled' => file_exists($sourcedir . '/ThankYouPost.php'), + 'error_msg' => $txt['sp_thankomatic_no_exist'], + ), + '10' => array( + 'name' => 'Advanced Reputation System Best', + 'mod_id' => 1129, + 'field' => '(mem.karmaGood - mem.karmaBad) AS karma, karmaGood, karmaBad', + 'order' => 'karma', + 'where' => 'mem.karmaGood > mem.karmaBad', + 'output_function' => create_function('&$row', ' + global $modSettings; + $descriptions = preg_split("/(\r)?\n/", $modSettings["karmaDescriptions"]); + $rep_bars = ""; + + $points = $row["karma"]; + $bars = ($points - ($points % $modSettings["karmaBarPoints"])) / $modSettings["karmaBarPoints"]; + $bars = $bars < 1 ? 1 : (($bars > $modSettings["karmaMaxBars"]) ? $modSettings["karmaMaxBars"] : $bars); + $description = $descriptions[$bars - 1]; + + for($i = 0; $i < $bars; $i++) + $rep_bars .= \'\' . $row[\'; + + $row += array( + "reputation_bars" => $rep_bars, + "amount" => "+" . $row["karma"], + ); + '), + 'output_text' => (!empty($txt['karma_power']) ? $txt['karma_power'] : '') . ': %amount%
%reputation_bars%', + 'enabled' => !empty($modSettings['karma_enabled']) && file_exists($settings['images_url'] . '/karmaBad_basic.gif'), + 'error_msg' => $txt['sp_reputation_no_exist'], + ), + '11' => array( + 'name' => 'Advanced Reputation System Worst', + 'mod_id' => 1129, + 'field' => '(karmaBad - karmaGood) AS karma, karmaGood, karmaBad', + 'order' => 'karma', + 'where' => 'mem.karmaBad > mem.karmaGood', + 'output_function' => create_function('&$row', ' + global $modSettings; + $rep_bars = ""; + + $points = $row["karma"]; + $bars = ($points - ($points % $modSettings["karmaBarPoints"])) / $modSettings["karmaBarPoints"]; + $bars = $bars < 1 ? 1 : (($bars > $modSettings["karmaMaxBars"]) ? $modSettings["karmaMaxBars"] : $bars); + $description = $descriptions[$bars - 1]; + + for($i = 0; $i < $bars; $i++) + $rep_bars .= \'\' . $row[\'; + + $row += array( + "reputation_bars" => $rep_bars, + "amount" => "-" . $row["karma"], + ); + '), + 'output_text' => (!empty($txt['karma_power']) ? $txt['karma_power'] : '') . ': %amount%
%reputation_bars%', + 'enabled' => !empty($modSettings['karma_enabled']) && file_exists($settings['images_url'] . '/karmaBad_basic.gif'), + 'error_msg' => $txt['sp_reputation_no_exist'], + ), + 'sa_shop_money' => array( + 'name' => 'SA Shop Money', + 'mod_id' => 1794, + 'field' => 'mem.cash, mem.purchHis, mem.tradeHis', + 'order' => 'mem.cash', + 'output_text' => (!empty($modSettings['shopprefix']) ? $modSettings['shopprefix'] : '') . '%cash%' . (!empty($modSettings['shopsurfix']) ? $modSettings['shopsurfix'] : ''), + 'enabled' => file_exists($sourcedir . 'shop2/Shop.php'), + 'error_msg' => $txt['sp_sashop_no_exist'], + ), + 'sa_shop_trades' => array( + 'name' => 'SA Shop Trades', + 'mod_id' => 1794, + 'field' => 'mem.cash, mem.purchHis, mem.tradeHis', + 'order' => 'mem.tradeHis', + 'output_text' => '%tradeHis%', + 'enabled' => file_exists($sourcedir . 'shop2/Shop.php') && !empty($modSettings['shop_Enable_Stats']), + 'error_msg' => $txt['sp_sashop_no_exist'], + ), + 'sa_shop_purchase' => array( + 'name' => 'SA Shop Purchase', + 'mod_id' => 1794, + 'field' => 'mem.cash, mem.purchHis, mem.tradeHis', + 'order' => 'mem.purchHis', + 'output_text' => '%purchHis%', + 'enabled' => file_exists($sourcedir . 'shop2/Shop.php') && !empty($modSettings['shop_Enable_Stats']), + 'error_msg' => $txt['sp_sashop_no_exist'], + ), + 'casino' => array( + 'name' => 'Casino Cash', + 'mod_id' => 1641, + 'field' => 'mem.cash', + 'order' => 'mem.cash', + 'output_text' => '%cash%', + 'enabled' => file_exists($sourcedir . 'casino/Casino.php'), + 'error_msg' => $txt['sp_sashop_no_exist'], + ), + ); + } + + // Standard Variables + $type = !empty($parameters['type']) ? $parameters['type'] : 0; + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; + $limit = empty($limit) ? 5 : $limit; + $sort_asc = !empty($parameters['sort_asc']); + // Time is in days :D, but i need seconds :P + $last_active_limit = !empty($parameters['last_active_limit']) ? $parameters['last_active_limit'] * 86400 : 0; + $enable_label = !empty($parameters['enable_label']); + $list_label = !empty($parameters['list_label']) ? $parameters['list_label'] : ''; + + // Setup current Block Type + $current_system = !empty($sp_topStatsSystem[$type]) ? $sp_topStatsSystem[$type] : array(); + + // What how could this happen? + if (empty($current_system)) + { + echo $txt['sp_topstats_unknown_type']; + return; + } + + // Possible to ouput? + if (empty($current_system['enabled'])) + { + echo (!empty($current_system['error_msg']) ? $current_system['error_msg'] : ''); + return; + } + + // This are the important fields, without the array have an mistake and it will not work :X + if (empty($current_system['field']) || empty($current_system['order'])) + { + echo $context['user']['is_admin'] ? $txt['sp_topstats_type_error'] : $txt['sp_topstats_unknown_type']; + return; + } + + // Switch the reverse? (It's a reverse to reverse the allready reverse, fun byside :P) + $sort_asc = !empty($current_system['reverse']) ? !$sort_asc : $sort_asc; + + // Create the where statment :) + $where = array(); + + // Some cached data availible? + $chache_id = 'sp_chache_' . $id . '_topStatsMember'; + if (empty($modSettings['sp_disableChache']) && !empty($modSettings[$chache_id])) + { + $data = explode(';', $modSettings[$chache_id]); + if($data[0] == $type && $data[1] == $limit && !empty($data[2]) == $sort_asc && $data[3] > time() - 300) // 5 Minute cache + $where[] = 'mem.id_member IN (' . $data[4] . ')'; + else + unset($modSettings[$chache_id]); + } + + // Last active remove + if (!empty($last_active_limit)) + { + $timeLimit = time() - $last_active_limit; + $where[] = "lastLogin > $timeLimit"; + } + if (!empty($current_system['where'])) + $where[] = $current_system['where']; + + if (!empty($where)) + $where = 'WHERE (' . implode(') + AND (', $where) . ')'; + else + $where = ""; + + // Okay load the data :D + $request = $smcFunc['db_query']('', ' + SELECT + mem.id_member, mem.real_name, mem.avatar, + a.id_attach, a.attachment_type, a.filename, + {raw:field} + FROM {db_prefix}members as mem + LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) + {raw:where} + ORDER BY {raw:order} {raw:sort} + LIMIT {int:limit}', array( + 'limit' => $context['common_stats']['total_members'] > 100 ? ($limit + 5) : $limit, // Prevent delete of user if the cache is avaible :D + 'field' => $current_system['field'], + 'where' => $where, + 'order' => $current_system['order'], + 'sort' => ($sort_asc ? 'ASC' : 'DESC'), + ) + ); + + $members = array(); + $colorids = array(); + $count = 1; + $chache_member_ids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + // Collect some to cache data =) + $chache_member_ids[$row['id_member']] = $row['id_member']; + if($count++ > $limit) + continue; + + $colorids[$row['id_member']] = $row['id_member']; + + 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 = ''; + } + + // Setup the row :P + $output = ''; + + // Prepare some data of the row? + if (!empty($current_system['output_function'])) + $current_system['output_function']($row); + + if (!empty($current_system['output_text'])) + { + $output = $current_system['output_text']; + foreach ($row as $item => $replacewith) + $output = str_replace('%' . $item . '%', $replacewith, $output); + } + + $members[] = array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], + 'link' => '' . $row['real_name'] . '', + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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']) + ), + 'output' => $output, + 'complete_row' => $row, + ); + } + $smcFunc['db_free_result']($request); + + if (empty($members)) + { + echo ' + ', $txt['error_sp_no_members_found']; + return; + } + + // Update the cache, at least around 100 members are needed for a good working version + if (empty($modSettings['sp_disableChache']) && $context['common_stats']['total_members'] > 0 && !empty($chache_member_ids) && count($chache_member_ids) > $limit && empty($modSettings[$chache_id])) + { + $toCache = array($type, $limit, ($sort_asc ? 1 : 0), time(), implode(',', $chache_member_ids)); + updateSettings(array($chache_id => implode(';', $toCache))); + } + // One time error, if this happen the chache need an update (Next reload is mystical fixed) + elseif(!empty($modSettings[$chache_id])) + updateSettings(array($chache_id => '0;0;0;1000;0')); + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($members as $k => $p) + { + if (!empty($color_profile[$p['id']]['link'])) + $members[$k]['link'] = $color_profile[$p['id']]['link']; + } + } + + echo ' + '; + + if($enable_label) + echo ' + + + '; + + foreach ($members as $member) + { + echo ' + + + + '; + } + echo ' +
', $list_label,'
', !empty($member['avatar']['href']) ? ' + ' . $member['name'] . '' : '', ' + + ', $member['link'], '
', $member['output'], ' +
'; + +} + +function sp_recent($parameters, $id, $return_parameters = false) +{ + global $txt, $scripturl, $settings, $context, $color_profile; + + $block_parameters = array( + 'boards' => 'boards', + 'limit' => 'int', + 'type' => 'select', + 'display' => 'select', + ); + + if ($return_parameters) + return $block_parameters; + + $boards = !empty($parameters['boards']) ? explode('|', $parameters['boards']) : null; + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; + $type = 'ssi_recent' . (empty($parameters['type']) ? 'Posts' : 'Topics'); + $display = empty($parameters['display']) ? 'compact' : 'full'; + + $items = $type($limit, null, $boards, 'array'); + + if (empty($items)) + { + echo ' + ', $txt['error_sp_no_posts_found']; + return; + } + else + $items[count($items) - 1]['is_last'] = true; + + $colorids = array(); + foreach ($items as $item) + $colorids[] = $item['poster']['id']; + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($items as $k => $p) + { + if (!empty($color_profile[$p['poster']['id']]['link'])) + $items[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link']; + } + } + + if ($display == 'compact') + { + foreach ($items as $key => $item) + echo ' + ', $item['subject'], ' ', $txt['by'], ' ', $item['poster']['link'], $item['new'] ? '' : ' ' . $txt['new'] . '', '
[', $item['time'], ']

', empty($item['is_last']) ? '
' : ''; + } + elseif ($display == 'full') + { + echo ' + '; + + foreach ($items as $item) + echo ' + + + + + '; + + echo ' +
+ ', sp_embed_image(empty($parameters['type']) ? 'post' : 'topic'), ' + + ', $item['subject'], ' + ', $item['new'] ? '' : '' . $txt['new'] . '', '
[', $item['board']['link'], '] +
+ ', $item['poster']['link'], '
', $item['time'], ' +
'; + } +} + +function sp_topTopics($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $txt, $scripturl, $user_info, $user_info, $modSettings, $topics; + + $block_parameters = array( + 'type' => 'select', + 'limit' => 'int', + ); + + if ($return_parameters) + return $block_parameters; + + $type = !empty($parameters['type']) ? $parameters['type'] : 0; + $limit = !empty($parameters['limit']) ? $parameters['limit'] : 5; + + $topics = ssi_topTopics($type ? 'views' : 'replies', $limit, 'array'); + + if (empty($topics)) + { + echo ' + ', $txt['error_sp_no_topics_found']; + return; + } + else + $topics[count($topics) - 1]['is_last'] = true; + + echo ' + '; +} + +function sp_topBoards($parameters, $id, $return_parameters = false) +{ + global $context, $settings, $smcFunc, $txt, $scripturl, $user_info, $user_info, $modSettings, $boards; + + $block_parameters = array( + 'limit' => 'int', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = !empty($parameters['limit']) ? $parameters['limit'] : 5; + + $boards = ssi_topBoards($limit, 'array'); + + if (empty($boards)) + { + echo ' + ', $txt['error_sp_no_boards_found']; + return; + } + else + $boards[count($boards) - 1]['is_last'] = true; + + echo ' + '; +} + +function sp_showPoll($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $context, $scripturl, $modSettings, $boardurl, $txt; + + $block_parameters = array( + 'topic' => 'int', + 'type' => 'select', + ); + + if ($return_parameters) + return $block_parameters; + + $topic = !empty($parameters['topic']) ? $parameters['topic'] : null; + $type = !empty($parameters['type']) ? (int) $parameters['type'] : 0; + $boardsAllowed = boardsAllowedTo('poll_view'); + + if (empty($boardsAllowed)) + { + loadLanguage('Errors'); + + echo ' + ', $txt['cannot_poll_view']; + return; + } + + if (!empty($type)) + { + $request = $smcFunc['db_query']('', ' + SELECT t.id_topic + FROM {db_prefix}polls AS p + INNER JOIN {db_prefix}topics AS t ON (t.id_poll = p.id_poll' . ($modSettings['postmod_active'] ? ' AND t.approved = {int:is_approved}' : '') . ') + INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board) + WHERE {query_wanna_see_board} + AND p.voting_locked = {int:not_locked}' . (!in_array(0, $boardsAllowed) ? ' + AND b.id_board IN ({array_int:boards_allowed_list})' : '') . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? ' + AND b.id_board != {int:recycle_enable}' : '') . ' + ORDER BY {raw:type} + LIMIT 1', + array( + 'boards_allowed_list' => $boardsAllowed, + 'not_locked' => 0, + 'is_approved' => 1, + 'recycle_enable' => $modSettings['recycle_board'], + 'type' => $type == 1 ? 'p.id_poll DESC' : 'RAND()', + ) + ); + list ($topic) = $smcFunc['db_fetch_row']($request); + $smcFunc['db_free_result']($request); + } + + if (empty($topic) || $topic < 0) + { + loadLanguage('Errors'); + + echo ' + ', $txt['topic_doesnt_exist']; + return; + } + + $poll = ssi_showPoll($topic, 'array'); + + if ($poll['allow_vote']) + { + echo ' +
+
    +
  • ', $poll['question'], '
  • +
  • ', $poll['allowed_warning'], '
  • '; + + foreach ($poll['options'] as $option) + echo ' +
  • '; + + echo ' +
  • +
  • ', $txt['sp-pollViewTopic'], '
  • +
+ + +
'; + } + elseif ($poll['allow_view_results']) + { + echo ' + '; + } + else + echo ' + ', $txt['poll_cannot_see']; +} + +function sp_boardNews($parameters, $id, $return_parameters = false) +{ + global $scripturl, $txt, $settings, $modSettings, $context, $smcFunc, $color_profile; + + $block_parameters = array( + 'board' => 'boards', + 'limit' => 'int', + 'start' => 'int', + 'length' => 'int', + 'avatar' => 'check', + 'per_page' => 'int', + ); + + if ($return_parameters) + return $block_parameters; + + $board = !empty($parameters['board']) ? explode('|', $parameters['board']) : null; + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; + $start = !empty($parameters['start']) ? (int) $parameters['start'] : 0; + $length = isset($parameters['length']) ? (int) $parameters['length'] : 250; + $avatars = !empty($parameters['avatar']); + $per_page = !empty($parameters['per_page']) ? (int) $parameters['per_page'] : 0; + + $limit = max(0, $limit); + $start = max(0, $start); + + loadLanguage('Stats'); + + $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'; + + $request = $smcFunc['db_query']('', ' + SELECT t.id_first_msg + FROM {db_prefix}topics AS t + INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board) + INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg) + WHERE ' . (empty($board) ? '{query_see_board} + AND t.id_first_msg >= {int:min_msg_id}' : 't.id_board IN ({array_int:current_board})') . ($modSettings['postmod_active'] ? ' + AND t.approved = {int:is_approved}' : '') . ' + AND (t.locked != {int:locked} OR m.icon != {string:icon}) + ORDER BY t.id_first_msg DESC + LIMIT {int:limit}', + array( + 'current_board' => $board, + 'min_msg_id' => $modSettings['maxMsgID'] - 45 * min($limit, 5), + 'is_approved' => 1, + 'locked' => 1, + 'icon' => 'moved', + 'limit' => $limit, + ) + ); + $posts = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + $posts[] = $row['id_first_msg']; + $smcFunc['db_free_result']($request); + + if (empty($posts)) + { + echo ' + ', $txt['error_sp_no_posts_found']; + return; + } + elseif (!empty($per_page)) + { + $limit = count($posts); + $start = !empty($_REQUEST['news' . $id]) ? (int) $_REQUEST['news' . $id] : 0; + + $clean_url = preg_replace('~news' . $id . '=\d+;?~', '', $_SERVER['REQUEST_URL']); + $current_url = $clean_url . (strpos($clean_url, '?') !== false ? (in_array(substr($clean_url, -1), array(';', '?')) ? '' : ';') : '?'); + + $page_index = constructPageIndex($current_url . 'news' . $id . '=%1$d', $start, $limit, $per_page, true); + } + + $request = $smcFunc['db_query']('', ' + SELECT + m.icon, m.subject, m.body, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time, + t.num_replies, t.id_topic, m.id_member, m.smileys_enabled, m.id_msg, t.locked, mem.avatar, + a.id_attach, a.attachment_type, a.filename, t.num_views + FROM {db_prefix}topics AS t + INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg) + LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) + LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = mem.id_member) + WHERE t.id_first_msg IN ({array_int:post_list}) + ORDER BY t.id_first_msg DESC + LIMIT ' . (!empty($per_page) ? '{int:start}, ' : '') . '{int:limit}', + array( + 'post_list' => $posts, + 'start' => $start, + 'limit' => !empty($per_page) ? $per_page : $limit, + ) + ); + $return = array(); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $limited = false; + if (($cutoff = $smcFunc['strpos']($row['body'], '[cutoff]')) !== false) + { + $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff); + $limited = true; + } + elseif (!empty($length) && $smcFunc['strlen']($row['body']) > $length) + { + $row['body'] = $smcFunc['substr']($row['body'], 0, $length); + $limited = true; + } + + $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']); + + // Only place an ellipsis if the body has been shortened. + if ($limited) + $row['body'] .= '...'; + + 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']); + + if (!empty($row['id_member'])) + $colorids[$row['id_member']] = $row['id_member']; + + $return[] = array( + 'id' => $row['id_topic'], + 'message_id' => $row['id_msg'], + 'icon' => '' . $row['icon'] . '', + 'subject' => $row['subject'], + 'time' => timeformat($row['poster_time']), + 'views' => $row['num_views'], + 'body' => $row['body'], + 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0', + 'link' => '' . $txt['sp-read_more'] . '', + 'replies' => $row['num_replies'], + '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']) ? '' : '| ' . $txt['ssi_write_comment'] . '', + 'new_comment' => !empty($row['locked']) ? '' : '| ' . $txt['ssi_write_comment'] . '', + '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'] . '' : $row['poster_name'] + ), + 'locked' => !empty($row['locked']), + 'is_last' => false, + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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']) + ), + ); + } + $smcFunc['db_free_result']($request); + + if (empty($return)) + { + echo ' + ', $txt['error_sp_no_posts_found']; + return; + } + + $return[count($return) - 1]['is_last'] = true; + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($return as $k => $p) + { + if (!empty($color_profile[$p['poster']['id']]['link'])) + $return[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link']; + } + } + + if ($context['SPortal']['core_compat']) + { + foreach ($return as $news) + { + echo ' +
+ + + + + + + + + + + +
', $news['icon'], '', $news['subject'], '
'; + + if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href'])) + echo ' + ', $news['poster']['name'], ' +
', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '
', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '
'; + else + echo ' +
', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '
'; + + echo ' +

', $news['body'], '

+
+
', $news['link'], ' ', $news['new_comment'], '
+
+
'; + } + } + else + { + foreach ($return as $news) + { + echo ' +
+

+ ', $news['icon'], '', $news['subject'], ' +

+
+
+ +
'; + + if ($avatars && $news['avatar']['name'] !== null && !empty($news['avatar']['href'])) + echo ' + ', $news['poster']['name'], ' +
', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], '
', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '
'; + else + echo ' +
', $news['time'], ' ', $txt['by'], ' ', $news['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $news['views'], ' | ', $txt['sp-articlesComments'], ': ', $news['replies'], '
'; + + echo ' +

', $news['body'], '
+
', $news['link'], ' ', $news['new_comment'], '
+
+ +
'; + } + } + + if (!empty($per_page)) + echo ' +
', $txt['sp-articlesPages'], ': ', $page_index, '
'; +} + +function sp_quickSearch($parameters, $id, $return_parameters = false) +{ + global $scripturl, $txt, $context; + + $block_parameters = array(); + + if ($return_parameters) + return $block_parameters; + + echo ' +
+
+
+ + +
+
'; +} + +function sp_news($parameters, $id, $return_parameters = false) +{ + global $context; + + $block_parameters = array(); + + if ($return_parameters) + return $block_parameters; + + echo ' +
', $context['random_news_line'], '
'; +} + +function sp_attachmentImage($parameters, $id, $return_parameters = false) +{ + global $boarddir, $txt, $color_profile; + + $block_parameters = array( + 'limit' => 'int', + 'direction' => 'select', + 'disablePoster' => 'check', + 'disableDownloads' => 'check', + 'disableLink' => 'check', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = empty($parameters['limit']) ? 5 : (int) $parameters['limit']; + $direction = empty($parameters['direction']) ? 0 : 1; + $type = array('jpg', 'png', 'gif', 'bmp'); + $showPoster = empty($parameters['disablePoster']); + $showDownloads = empty($parameters['disableDownloads']); + $showLink = empty($parameters['disableLink']); + + $items = ssi_recentAttachments($limit, $type, 'array'); + + if (empty($items)) + { + echo ' + ', $txt['error_sp_no_attachments_found']; + return; + } + + $colorids = array(); + foreach ($items as $item) + $colorids[] = $item['member']['id']; + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($items as $k => $p) + { + if (!empty($color_profile[$p['member']['id']]['link'])) + $items[$k]['member']['link'] = $color_profile[$p['member']['id']]['link']; + } + } + + echo ' + ', $direction ? ' + ' : ''; + + foreach ($items as $item) + { + echo !$direction ? ' + ' : '', ' + ', !$direction ? ' + ' : ''; + } + + echo $direction ? ' + ' : '', ' +
+
', ($showLink ? ' + ' . $item['file']['filename'] . '
' : ''), ' + ', $item['file']['image']['link'], '
', ($showDownloads ? ' + ' . $txt['downloads'] . ': ' . $item['file']['downloads'] . '
' : ''), ($showPoster ? ' + ' . $txt['posted_by'] . ': ' . $item['member']['link'] : ''), ' +
+
'; +} + +function sp_attachmentRecent($parameters, $id, $return_parameters = false) +{ + global $txt; + + $block_parameters = array( + 'limit' => 'int', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = empty($parameters['limit']) ? 5 : (int) $parameters['limit']; + + $items = ssi_recentAttachments($limit, array(), 'array'); + + if (empty($items)) + { + echo ' + ', $txt['error_sp_no_attachments_found']; + return; + } + + echo ' + '; +} + +function sp_calendar($parameters, $id, $return_parameters = false) +{ + global $context, $sourcedir, $modSettings, $options, $scripturl, $txt; + + $block_parameters = array( + 'events' => 'check', + 'birthdays' => 'check', + 'holidays' => 'check', + ); + + if ($return_parameters) + return $block_parameters; + + require_once($sourcedir . '/Subs-Calendar.php'); + $today = getTodayInfo(); + + $curPage = array( + 'day' => $today['day'], + 'month' => $today['month'], + 'year' => $today['year'] + ); + + $calendarOptions = array( + 'start_day' => !empty($options['calendar_start_day']) ? $options['calendar_start_day'] : 0, + 'show_week_num' => false, + 'show_events' => !empty($parameters['events']), + 'show_birthdays' => !empty($parameters['birthdays']), + 'show_holidays' => !empty($parameters['holidays']), + ); + $calendar_data = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions); + + echo ' + + + + '; + + foreach ($calendar_data['week_days'] as $day) + echo ' + '; + + echo ' + '; + + foreach ($calendar_data['weeks'] as $week_key => $week) + { + echo ''; + + foreach ($week['days'] as $day_key => $day) + { + echo ' + '; + } + + echo ' + '; + } + + echo ' +
+ ', !empty($modSettings['cal_enabled']) ? '' . $txt['months_titles'][$calendar_data['current_month']] . ' ' . $calendar_data['current_year'] . '' : $txt['months_titles'][$calendar_data['current_month']] . ' ' . $calendar_data['current_year'], ' +
', $txt['days_short'][$day], '
'; + + if (empty($day['day'])) + unset($calendar_data['weeks'][$week_key]['days'][$day_key]); + else + { + if (!empty($day['holidays']) || !empty($day['birthdays']) || !empty($day['events'])) + echo '', $day['is_today'] ? '[' : '', $day['day'], $day['is_today'] ? ']' : '', ''; + else + echo '', $day['is_today'] ? '[' : '', $day['day'], $day['is_today'] ? ']' : '', ''; + } + + echo '
+
'; + + foreach ($calendar_data['weeks'] as $week) + { + foreach ($week['days'] as $day) + { + if (empty($day['holidays']) && empty($day['birthdays']) && empty($day['events']) && !$day['is_today']) + continue; + elseif (empty($day['holidays']) && empty($day['birthdays']) && empty($day['events'])) + { + echo ' +
', $txt['error_sp_no_items_day'], '
'; + + continue; + } + + echo ' + '; + } + } + + echo ' + + '; +} + +function sp_calendarInformation($parameters, $id, $return_parameters = false) +{ + global $scripturl, $modSettings, $txt; + + $block_parameters = array( + 'events' => 'check', + 'future' => 'int', + 'birthdays' => 'check', + 'holidays' => 'check', + ); + + if ($return_parameters) + return $block_parameters; + + $show_event = !empty($parameters['events']); + $event_future = !empty($parameters['future']) ? (int) $parameters['future'] : 0; + $event_future = abs($event_future); + $show_birthday = !empty($parameters['birthdays']); + $show_holiday = !empty($parameters['holidays']); + $show_titles = false; + + if (!$show_event && !$show_birthday && !$show_holiday) + { + echo ' + ', $txt['sp_calendar_noEventsFound']; + return; + } + + $now = forum_time(); + $today_date = date("Y-m-d", $now); + $calendar_array = array( + 'todayEvents' => array(), + 'futureEvents' => array(), + 'todayBirthdays' => array(), + 'todayHolidays' => array() + ); + + if ($show_event) + { + if (!empty($event_future)) + $event_future_date = date("Y-m-d", ($now + $event_future * 86400)); + else + $event_future_date = $today_date; + + $events = sp_loadCalendarData('getEvents', $today_date, $event_future_date); + + ksort($events); + + $displayed = array(); + foreach ($events as $day => $day_events) + foreach ($day_events as $event_key => $event) + if (in_array($event['id'], $displayed)) + unset($events[$day][$event_key]); + else + $displayed[] = $event['id']; + + if (!empty($events[$today_date])) + { + $calendar_array['todayEvents'] = $events[$today_date]; + unset($events[$today_date]); + } + + if (!empty($events)) + { + ksort($events); + $calendar_array['futureEvents'] = $events; + } + } + + if ($show_birthday) + { + $calendar_array['todayBirthdays'] = current(sp_loadCalendarData('getBirthdays', $today_date)); + $show_titles = !empty($show_event) || !empty($show_holiday); + } + + if ($show_holiday) + { + $calendar_array['todayHolidays'] = current(sp_loadCalendarData('getHolidays', $today_date)); + $show_titles = !empty($show_event) || !empty($show_birthday); + } + + if (empty($calendar_array['todayEvents']) && empty($calendar_array['futureEvents']) && empty($calendar_array['todayBirthdays']) && empty($calendar_array['todayHolidays'])) + { + echo ' + ', $txt['sp_calendar_noEventsFound']; + return; + } + else + { + echo ' + '; + } +} + +function sp_rssFeed($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $sourcedir, $context, $txt; + + $block_parameters = array( + 'url' => 'text', + 'show_title' => 'check', + 'show_content' => 'check', + 'show_date' => 'check', + 'strip_preserve' => 'text', + 'count' => 'int', + 'limit' => 'int', + ); + + if ($return_parameters) + return $block_parameters; + + $feed = !empty($parameters['url']) ? un_htmlspecialchars($parameters['url']) : ''; + $show_title = !empty($parameters['show_title']); + $show_content = !empty($parameters['show_content']); + $show_date = !empty($parameters['show_date']); + $strip_preserve = !empty($parameters['strip_preserve']) ? $parameters['strip_preserve'] : 'br'; + $strip_preserve = preg_match_all('~[A-Za-z0-9]+~', $strip_preserve, $match) ? $match[0] : array(); + $count = !empty($parameters['count']) ? (int) $parameters['count'] : 5; + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 150; + + if (empty($feed)) + { + echo ' + ', $txt['error_sp_invalid_feed']; + return; + } + + $rss = array(); + + require_once($sourcedir . '/Subs-Package.php'); + $data = fetch_web_data($feed); + + if (function_exists('mb_convert_encoding')) + { + preg_match('~encoding="([^"]*)"~', $data, $charset); + + if (!empty($charset[1]) && $charset != $context['character_set']) + $data = mb_convert_encoding($data, $context['character_set'], $charset[1]); + } + elseif (function_exists('iconv')) + { + preg_match('~encoding="([^"]*)"~', $data, $charset); + + if (!empty($charset[1]) && $charset != $context['character_set']) + $data = iconv($charset[1], $context['character_set'], $data); + } + + $data = str_replace(array("\n", "\r", "\t"), '', $data); + $data = preg_replace('~<\!\[CDATA\[(.+?)\]\]>~e' . ($context['utf8'] ? 'u' : ''), '\'#cdata_escape_encode#\' . $smcFunc[\'htmlspecialchars\'](\'$1\')', $data); + + preg_match_all('~(.+?)~', $data, $items); + + foreach ($items[1] as $item_id => $item) + { + if ($item_id === $count) + break; + + preg_match_all('~<([A-Za-z]+)>(.+?)~', $item, $match); + + foreach ($match[0] as $tag_id => $dummy) + { + if ($smcFunc['strpos']($match[2][$tag_id], '#cdata_escape_encode#') === 0) + $match[2][$tag_id] = stripslashes(un_htmlspecialchars($smcFunc['substr']($match[2][$tag_id], 21))); + + $rss[$item_id][strtolower($match[1][$tag_id])] = un_htmlspecialchars($match[2][$tag_id]); + } + } + + if (empty($rss)) + { + echo ' + ', $txt['error_sp_invalid_feed']; + return; + } + + $items = array(); + foreach ($rss as $item) + { + $item['title'] = isset($item['title']) ? strip_tags($item['title']) : ''; + $item['description'] = isset($item['description']) ? strip_tags($item['description'], empty($strip_preserve) ? '' : '<' . implode('><', $strip_preserve) . '>') : ''; + + $items[] = array( + 'title' => $item['title'], + 'href' => $item['link'], + 'link' => $item['title'] == '' ? '' : ($item['link'] == '' ? $item['title'] : '' . $item['title'] . ''), + 'content' => $limit > 0 && $smcFunc['strlen']($item['description']) > $limit ? $smcFunc['substr']($item['description'], 0, $limit) . '...' : $item['description'], + 'date' => !empty($item['pubdate']) ? timeformat(strtotime($item['pubdate']), '%d %B') : '', + ); + } + + if (empty($items)) + { + echo ' + ', $txt['error_sp_invalid_feed']; + return; + } + else + $items[count($items) - 1]['is_last'] = true; + + if ($show_content) + { + echo ' +
+
    '; + + foreach ($items as $item) + { + if ($show_title && !empty($item['link'])) + echo ' +
  • ', sp_embed_image('post'), ' ', $item['link'], '', ($show_date && !empty($item['date']) ? ' - ' . $item['date'] : ''), '
  • '; + echo ' + ', $item['content'], ''; + } + + echo ' +
+
'; + } + else + { + echo ' + '; + } +} + +function sp_theme_select($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $context, $modSettings, $user_info, $settings, $language, $txt; + + $block_parameters = array(); + + if ($return_parameters) + return $block_parameters; + + loadLanguage('Profile'); + loadLanguage('Themes'); + + if (!empty($_SESSION['id_theme']) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum'))) + $current_theme = (int) $_SESSION['id_theme']; + else + $current_theme = $user_info['theme']; + + $current_theme = empty($current_theme) ? -1 : $current_theme; + $available_themes = array(); + if (!empty($modSettings['knownThemes'])) + { + $request = $smcFunc['db_query']('', ' + SELECT id_theme, variable, value + FROM {db_prefix}themes + WHERE variable IN ({string:name}, {string:theme_url}, {string:theme_dir}, {string:images_url}) + AND id_theme IN ({array_string:known_themes}) + AND id_theme != {int:default_theme}', + array( + 'default_theme' => 0, + 'name' => 'name', + 'theme_url' => 'theme_url', + 'theme_dir' => 'theme_dir', + 'images_url' => 'images_url', + 'known_themes' => explode(',', $modSettings['knownThemes']), + ) + ); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!isset($available_themes[$row['id_theme']])) + $available_themes[$row['id_theme']] = array( + 'id' => $row['id_theme'], + 'selected' => $current_theme == $row['id_theme'], + ); + $available_themes[$row['id_theme']][$row['variable']] = $row['value']; + } + $smcFunc['db_free_result']($request); + } + + if (!isset($available_themes[$modSettings['theme_guests']])) + { + $available_themes[0] = array( + 'num_users' => 0 + ); + $guest_theme = 0; + } + else + $guest_theme = $modSettings['theme_guests']; + + $current_images_url = $settings['images_url']; + + foreach ($available_themes as $id_theme => $theme_data) + { + if ($id_theme == 0) + continue; + + $settings['images_url'] = &$theme_data['images_url']; + + if (file_exists($theme_data['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php')) + include($theme_data['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php'); + elseif (file_exists($theme_data['theme_dir'] . '/languages/Settings.' . $language . '.php')) + include($theme_data['theme_dir'] . '/languages/Settings.' . $language . '.php'); + else + { + $txt['theme_thumbnail_href'] = $theme_data['images_url'] . '/thumbnail.gif'; + $txt['theme_description'] = ''; + } + + $available_themes[$id_theme]['thumbnail_href'] = $txt['theme_thumbnail_href']; + $available_themes[$id_theme]['description'] = $txt['theme_description']; + + $available_themes[$id_theme]['name'] = preg_replace('~\stheme$~i', '', $theme_data['name']); + if ($smcFunc['strlen']($available_themes[$id_theme]['name']) > 18) + $available_themes[$id_theme]['name'] = $smcFunc['substr']($available_themes[$id_theme]['name'], 0, 18) . '...'; + } + + $settings['images_url'] = $current_images_url; + + if ($guest_theme != 0) + $available_themes[-1] = $available_themes[$guest_theme]; + + $available_themes[-1]['id'] = -1; + $available_themes[-1]['name'] = $txt['theme_forum_default']; + $available_themes[-1]['selected'] = $current_theme == 0; + $available_themes[-1]['description'] = $txt['theme_global_description']; + + ksort($available_themes); + + // Validate the selected theme id. + if (!array_key_exists($current_theme, $available_themes)) + { + $current_theme = -1; + $available_themes[-1]['selected'] = true; + } + + if (!empty($_POST['sp_ts_submit']) && !empty($_POST['sp_ts_permanent']) && !empty($_POST['theme']) && isset($available_themes[$_POST['theme']]) && (!empty($modSettings['theme_allow']) || allowedTo('admin_forum'))) + updateMemberData($user_info['id'], array('id_theme' => $_POST['theme'] == -1 ? 0 : (int) $_POST['theme'])); + + echo ' +
+
+ +

+ ', $available_themes[$current_theme]['name'], ' +

+ ', $txt['sp-theme_permanent'], ' +
+ +
+
+ '; +} + +function sp_staff($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $sourcedir, $scripturl, $modSettings, $color_profile; + + $block_parameters = array( + 'lmod' => 'check', + ); + + if ($return_parameters) + return $block_parameters; + + require_once($sourcedir . '/Subs-Members.php'); + + if (empty($parameters['lmod'])) + { + $request = $smcFunc['db_query']('', ' + SELECT id_member + FROM {db_prefix}moderators AS mods', + array( + ) + ); + $local_mods = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + $local_mods[$row['id_member']] = $row['id_member']; + $smcFunc['db_free_result']($request); + + if (count($local_mods) > 10) + $local_mods = array(); + } + else + $local_mods = array(); + + $global_mods = membersAllowedTo('moderate_board', 0); + $admins = membersAllowedTo('admin_forum'); + + $all_staff = array_merge($local_mods, $global_mods, $admins); + $all_staff = array_unique($all_staff); + + $request = $smcFunc['db_query']('', ' + SELECT + m.id_member, m.real_name, m.avatar, mg.group_name, + a.id_attach, a.attachment_type, a.filename + FROM {db_prefix}members AS m + LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member) + LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN m.id_group = {int:reg_group_id} THEN m.id_post_group ELSE m.id_group END) + WHERE m.id_member IN ({array_int:staff_list})', + array( + 'staff_list' => $all_staff, + 'reg_group_id' => 0, + ) + ); + $staff_list = array(); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $colorids[$row['id_member']] = $row['id_member']; + + 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 (in_array($row['id_member'], $admins)) + $row['type'] = 1; + elseif (in_array($row['id_member'], $global_mods)) + $row['type'] = 2; + else + $row['type'] = 3; + + $staff_list[$row['type'] . '-' . $row['id_member']] = array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'link' => '' . $row['real_name'] . '', + 'group' => $row['group_name'], + 'type' => $row['type'], + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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']) + ), + ); + } + $smcFunc['db_free_result']($request); + + ksort($staff_list); + $staff_count = count($staff_list); + $count = 0; + $icons = array(1 => 'admin', 'gmod', 'lmod'); + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($staff_list as $k => $p) + { + if (!empty($color_profile[$p['id']]['link'])) + $staff_list[$k]['link'] = $color_profile[$p['id']]['link']; + } + } + + echo ' + '; + + foreach ($staff_list as $staff) + echo ' + + + + '; + + echo ' +
', !empty($staff['avatar']['href']) ? ' + ' . $staff['name'] . '' : '', ' + + ', sp_embed_image($icons[$staff['type']]), ' ', $staff['link'], '
+ ', $staff['group'], ' +
'; +} + +function sp_articles($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $sourcedir, $modSettings, $scripturl, $txt, $color_profile; + + $block_parameters = array( + 'category' => array(0 => $txt['sp_all']), + 'limit' => 'int', + 'type' => 'select', + 'image' => 'select', + ); + + if ($return_parameters) + { + require_once($sourcedir . '/Subs-PortalAdmin.php'); + + $categories = getCategoryInfo(); + foreach ($categories as $category) + $block_parameters['category'][$category['id']] = $category['name']; + + return $block_parameters; + } + + $category = empty($parameters['category']) ? 0 : (int) $parameters['category']; + $limit = empty($parameters['limit']) ? 5 : (int) $parameters['limit']; + $type = empty($parameters['type']) ? 0 : 1; + $image = empty($parameters['image']) ? 0 : (int) $parameters['image']; + + $request = $smcFunc['db_query']('',' + SELECT + m.id_topic, m.subject, m.poster_name, c.picture, c.name, + mem.id_member, mem.real_name, 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}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}' . (!empty($category) ? ' + AND a.id_category = {int:category}' : '') . ' + ORDER BY {raw:type} + LIMIT {int:limit}', + array( + 'approved' => 1, + 'category' => $category, + 'type' => $type ? 'RAND()' : 'm.poster_time DESC', + 'limit' => $limit, + ) + ); + $articles = array(); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($row['id_member'])) + $colorids[$row['id_member']] = $row['id_member']; + + 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 = ''; + } + + $articles[] = array( + 'id' => $row['id_topic'], + 'name' => $row['subject'], + 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0', + 'link' => '' . $row['subject'] . '', + 'poster' => array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], + 'link' => empty($row['id_member']) ? $row['poster_name'] : '' . $row['real_name'] . '', + ), + 'image' => array( + 'href' => $row['picture'], + 'image' => '' . $row['name'] . '', + ), + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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']) + ), + ); + } + $smcFunc['db_free_result']($request); + + if (empty($articles)) + { + echo ' + ', $txt['error_sp_no_articles_found']; + return; + } + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($articles as $k => $p) + { + if (!empty($color_profile[$p['poster']['id']]['link'])) + $articles[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link']; + } + } + + if (empty($image)) + { + echo ' + '; + } + else + { + echo ' + '; + + foreach ($articles as $article) + { + echo ' + + + + '; + } + + echo ' +
'; + + if (!empty($article['avatar']['href']) && $image == 1) + echo '', $article['poster']['name'], ''; + elseif (!empty($article['image']['href']) && $image == 2) + echo '', $article['name'], ''; + + echo ' + ', $article['poster']['link'], '
+ ', $article['link'], ' +
'; + } +} + +function sp_shoutbox($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $context, $sourcedir, $modSettings, $user_info, $settings, $txt, $scripturl; + + $block_parameters = array( + 'shoutbox' => array(), + ); + + if ($return_parameters) + { + $shoutboxes = sportal_get_shoutbox(); + $in_use = array(); + + $request = $smcFunc['db_query']('',' + SELECT id_block, value + FROM {db_prefix}sp_parameters + WHERE variable = {string:name}', + array( + 'name' => 'shoutbox', + ) + ); + while ($row = $smcFunc['db_fetch_assoc']($request)) + if (empty($_REQUEST['block_id']) || $_REQUEST['block_id'] != $row['id_block']) + $in_use[] = $row['value']; + $smcFunc['db_free_result']($request); + + foreach ($shoutboxes as $shoutbox) + if (!in_array($shoutbox['id'], $in_use)) + $block_parameters['shoutbox'][$shoutbox['id']] = $shoutbox['name']; + + if (empty($block_parameters['shoutbox'])) + fatal_error(allowedTo(array('sp_admin', 'sp_manage_shoutbox')) ? $txt['error_sp_no_shoutbox'] . '
' . sprintf($txt['error_sp_no_shoutbox_sp_moderator'], $scripturl . '?action=admin;area=portalshoutbox;sa=add') : $txt['error_sp_no_shoutbox_normaluser'], false); + + return $block_parameters; + } + + loadTemplate('PortalShoutbox'); + loadLanguage('Post'); + + $shoutbox = sportal_get_shoutbox($parameters['shoutbox'], true, true); + + if (empty($shoutbox)) + { + echo ' + ', $txt['error_sp_shoutbox_not_exist']; + return; + } + + if (!empty($_POST['new_shout']) && !empty($_POST['submit_shout']) && !empty($_POST['shoutbox_id']) && $_POST['shoutbox_id'] == $shoutbox['id']) + { + checkSession(); + + is_not_guest(); + + if (!($flood = sp_prevent_flood('spsbp', false))) + { + require_once($sourcedir . '/Subs-Post.php'); + + $_POST['new_shout'] = $smcFunc['htmlspecialchars'](trim($_POST['new_shout'])); + preparsecode($_POST['new_shout']); + + if (!empty($_POST['new_shout'])) + sportal_create_shout($shoutbox, $_POST['new_shout']); + } + else + $shoutbox['warning'] = $flood; + } + + $can_moderate = allowedTo('sp_admin') || allowedTo('sp_manage_shoutbox'); + if (!$can_moderate && !empty($shoutbox['moderator_groups'])) + $can_moderate = count(array_intersect($user_info['groups'], $shoutbox['moderator_groups'])) > 0; + + $shout_parameters = array( + 'limit' => $shoutbox['num_show'], + 'bbc' => $shoutbox['allowed_bbc'], + 'reverse' => $shoutbox['reverse'], + 'cache' => $shoutbox['caching'], + 'can_moderate' => $can_moderate, + ); + $shoutbox['shouts'] = sportal_get_shouts($shoutbox['id'], $shout_parameters); + + $shoutbox['warning'] = parse_bbc($shoutbox['warning']); + $context['can_shout'] = $context['user']['is_logged']; + + if ($context['can_shout']) + { + $settings['smileys_url'] = $modSettings['smileys_url'] . '/' . $user_info['smiley_set']; + $shoutbox['smileys'] = array('normal' => array(), 'popup' => array()); + if (empty($modSettings['smiley_enable'])) + $shoutbox['smileys']['normal'] = array( + array('code' => ':)', 'filename' => 'smiley.gif', 'description' => $txt['icon_smiley']), + array('code' => ';)', 'filename' => 'wink.gif', 'description' => $txt['icon_wink']), + array('code' => ':D', 'filename' => 'cheesy.gif', 'description' => $txt['icon_cheesy']), + array('code' => ';D', 'filename' => 'grin.gif', 'description' => $txt['icon_grin']), + array('code' => '>:(', 'filename' => 'angry.gif', 'description' => $txt['icon_angry']), + array('code' => ':(', 'filename' => 'sad.gif', 'description' => $txt['icon_sad']), + array('code' => ':o', 'filename' => 'shocked.gif', 'description' => $txt['icon_shocked']), + array('code' => '8)', 'filename' => 'cool.gif', 'description' => $txt['icon_cool']), + array('code' => '???', 'filename' => 'huh.gif', 'description' => $txt['icon_huh']), + array('code' => '::)', 'filename' => 'rolleyes.gif', 'description' => $txt['icon_rolleyes']), + array('code' => ':P', 'filename' => 'tongue.gif', 'description' => $txt['icon_tongue']), + array('code' => ':-[', 'filename' => 'embarrassed.gif', 'description' => $txt['icon_embarrassed']), + array('code' => ':-X', 'filename' => 'lipsrsealed.gif', 'description' => $txt['icon_lips']), + array('code' => ':-\\', 'filename' => 'undecided.gif', 'description' => $txt['icon_undecided']), + array('code' => ':-*', 'filename' => 'kiss.gif', 'description' => $txt['icon_kiss']), + array('code' => ':\'(', 'filename' => 'cry.gif', 'description' => $txt['icon_cry']) + ); + else + { + if (($temp = cache_get_data('shoutbox_smileys', 3600)) == null) + { + $request = $smcFunc['db_query']('', ' + SELECT code, filename, description, smiley_row, hidden + FROM {db_prefix}smileys + WHERE hidden IN ({array_int:hidden}) + ORDER BY smiley_row, smiley_order', + array( + 'hidden' => array(0, 2), + ) + ); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $row['filename'] = htmlspecialchars($row['filename']); + $row['description'] = htmlspecialchars($row['description']); + $row['code'] = htmlspecialchars($row['code']); + $shoutbox['smileys'][empty($row['hidden']) ? 'normal' : 'popup'][] = $row; + } + $smcFunc['db_free_result']($request); + + cache_put_data('shoutbox_smileys', $shoutbox['smileys'], 3600); + } + else + $shoutbox['smileys'] = $temp; + } + + foreach (array_keys($shoutbox['smileys']) as $location) + { + $n = count($shoutbox['smileys'][$location]); + for ($i = 0; $i < $n; $i++) + { + $shoutbox['smileys'][$location][$i]['code'] = addslashes($shoutbox['smileys'][$location][$i]['code']); + $shoutbox['smileys'][$location][$i]['js_description'] = addslashes($shoutbox['smileys'][$location][$i]['description']); + } + + if (!empty($shoutbox['smileys'][$location])) + $shoutbox['smileys'][$location][$n - 1]['last'] = true; + } + + $shoutbox['bbc'] = array( + 'bold' => array('code' => 'b', 'before' => '[b]', 'after' => '[/b]', 'description' => $txt['bold']), + 'italicize' => array('code' => 'i', 'before' => '[i]', 'after' => '[/i]', 'description' => $txt['italic']), + 'underline' => array('code' => 'u', 'before' => '[u]', 'after' => '[/u]', 'description' => $txt['underline']), + 'strike' => array('code' => 's', 'before' => '[s]', 'after' => '[/s]', 'description' => $txt['strike']), + 'pre' => array('code' => 'pre', 'before' => '[pre]', 'after' => '[/pre]', 'description' => $txt['preformatted']), + 'flash' => array('code' => 'flash', 'before' => '[flash=200,200]', 'after' => '[/flash]', 'description' => $txt['flash']), + 'img' => array('code' => 'img', 'before' => '[img]', 'after' => '[/img]', 'description' => $txt['image']), + 'url' => array('code' => 'url', 'before' => '[url]', 'after' => '[/url]', 'description' => $txt['hyperlink']), + 'email' => array('code' => 'email', 'before' => '[email]', 'after' => '[/email]', 'description' => $txt['insert_email']), + 'ftp' => array('code' => 'ftp', 'before' => '[ftp]', 'after' => '[/ftp]', 'description' => $txt['ftp']), + 'glow' => array('code' => 'glow', 'before' => '[glow=red,2,300]', 'after' => '[/glow]', 'description' => $txt['glow']), + 'shadow' => array('code' => 'shadow', 'before' => '[shadow=red,left]', 'after' => '[/shadow]', 'description' => $txt['shadow']), + 'sup' => array('code' => 'sup', 'before' => '[sup]', 'after' => '[/sup]', 'description' => $txt['superscript']), + 'sub' => array('code' => 'sub', 'before' => '[sub]', 'after' => '[/sub]', 'description' => $txt['subscript']), + 'tele' => array('code' => 'tt', 'before' => '[tt]', 'after' => '[/tt]', 'description' => $txt['teletype']), + 'code' => array('code' => 'code', 'before' => '[code]', 'after' => '[/code]', 'description' => $txt['bbc_code']), + 'quote' => array('code' => 'quote', 'before' => '[quote]', 'after' => '[/quote]', 'description' => $txt['bbc_quote']), + ); + } + + template_shoutbox_embed($shoutbox); +} + +function sp_gallery($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $context, $modSettings, $scripturl; + global $sourcedir, $txt, $settings, $boardurl, $galurl; + static $mod, $GD_Installed; + + $block_parameters = array( + 'limit' => 'int', + 'type' => 'select', + 'direction' => 'select', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = empty($parameters['limit']) ? 1 : (int) $parameters['limit']; + $type = empty($parameters['type']) ? 0 : 1; + $direction = empty($parameters['direction']) ? 0 : 1; + + if (!isset($mod)) + { + if (file_exists($sourcedir . '/Aeva-Media.php')) + $mod = 'aeva_media'; + elseif (file_exists($sourcedir . '/MGallery.php')) + $mod = 'smf_media_gallery'; + elseif (file_exists($sourcedir . '/Gallery.php') || file_exists($sourcedir . '/Gallery2.php')) + $mod = 'smf_gallery'; + else + $mod = ''; + } + + if (empty($mod)) + { + echo ' + ', $txt['error_sp_no_gallery_found']; + return; + } + elseif ($mod == 'aeva_media') + { + require_once($sourcedir . '/Aeva-Subs.php'); + + $items = aeva_getMediaItems(0, $limit, $type ? 'RAND()' : 'm.id_media DESC'); + } + elseif ($mod == 'smf_media_gallery') + { + require_once($sourcedir . '/Subs-MGallery.php'); + + loadMGal_Settings(); + loadLanguage('MGallery', sp_languageSelect('MGallery')); + + $items = getMediaItems(0, $limit, $type ? 'RAND()' : 'm.id_media DESC'); + } + elseif ($mod == 'smf_gallery') + { + loadLanguage('Gallery', sp_languageSelect('Gallery')); + + if (!isset($GD_Installed)) + $GD_Installed = function_exists('imagecreate'); + + if (empty($modSettings['gallery_url'])) + $modSettings['gallery_url'] = $boardurl . '/gallery/'; + + $request = $smcFunc['db_query']('',' + SELECT + p.id_picture, p.commenttotal, p.filesize, p.views, p.thumbfilename, + p.filename, p.height, p.width, p.title, p.id_member, m.member_name, + m.real_name, p.date, p.description + FROM {db_prefix}gallery_pic AS p + LEFT JOIN {db_prefix}members AS m ON (m.id_member = p.id_member) + WHERE p.approved = {int:is_approved} + ORDER BY {raw:type} + LIMIT {int:limit}', + array( + 'is_approved' => 1, + 'type' => $type ? 'RAND()' : 'p.id_picture DESC', + 'limit' => $limit, + ) + ); + $items = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $items[] = array( + 'id' => $row['id_picture'], + 'title' => $row['title'], + 'views' => $row['views'], + 'poster_id' => $row['id_member'], + 'poster_name' => $row['real_name'], + 'poster_link' => empty($row['id_member']) ? $txt['gallery_guest'] : '' . $row['real_name'] . '', + 'thumbfilename' => $row['thumbfilename'], + 'filename' => $row['filename'], + 'src' => $modSettings['gallery_url'] . ($GD_Installed ? $row['thumbfilename'] : $row['filename'] . '" width="120'), + ); + } + $smcFunc['db_free_result']($request); + } + + if (empty($items)) + { + echo ' + ', $txt['error_sp_no_pictures_found']; + return; + } + + echo ' + ', $direction ? ' + ' : ''; + + foreach ($items as $item) + { + echo !$direction ? ' + ' : '', ' + ', !$direction ? ' + ' : ''; + } + + echo $direction ? ' + ' : '', ' +
+
'; + + if ($mod == 'aeva_media') + { + echo ' + ', $item['title'], '
+
+ ', $txt['aeva_views'], ': ', $item['views'], '
+ ', $txt['aeva_posted_by'], ': ', $item['poster_name'], '
+ ', $txt['aeva_in_album'], ': ', $item['album_name'], '', $item['is_new'] ? + '
' : ''; + } + elseif ($mod == 'smf_media_gallery') + { + echo ' + ', $item['title'], '
+
+ ', $txt['mgallery_views'], ': ', $item['views'], '
+ ', $txt['mgallery_posted_by'], ': ', $item['poster_name'], '
+ ', $txt['mgallery_in_album'], ': ', $item['album_name'], '', $item['is_new'] ? + '
' : ''; + } + elseif ($mod == 'smf_gallery') + { + echo ' + ', $item['title'], '
+
+ ', $txt['gallery_text_views'], $item['views'], '
+ ', $txt['gallery_text_by'], ' ', $item['poster_link'], '
'; + } + + echo ' +
+
'; +} + +function sp_arcade($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $sourcedir, $scripturl, $settings, $txt, $color_profile; + static $mod; + + $block_parameters = array( + 'limit' => 'int', + 'type' => 'select', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; + $type = !empty($parameters['type']) ? (int) $parameters['type'] : 0; + + if (!isset($mod)) + { + if (file_exists($sourcedir . '/Arcade.php')) + $mod = 'smf_arcade'; + else + $mod = ''; + } + + if (empty($mod)) + { + echo ' + ', $txt['error_sp_no_arcade_found']; + return; + } + elseif ($mod == 'smf_arcade') + { + require_once($sourcedir . '/ArcadeStats.php'); + require_once($sourcedir . '/Subs-Arcade.php'); + loadLanguage('Arcade'); + + if (empty($type)) + $stats = ArcadeStats_MostPlayed($limit); + elseif ($type == 1) + $stats = ArcadeStats_BestPlayers($limit); + elseif ($type == 2) + $stats = ArcadeStats_LongestChampions($limit); + + if (empty($stats)) + { + echo ' + ', $txt['error_sp_no_stats_found']; + return; + } + else + $stats[count($stats) - 1]['last'] = true; + + echo ' + '; + } +} + +function sp_shop($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $sourcedir, $scripturl, $txt, $color_profile; + global $context, $boardurl, $modSettings; + static $mod; + + $block_parameters = array( + 'style' => 'select', + 'limit' => 'int', + 'type' => 'select', + 'sort' => 'select', + ); + + if ($return_parameters) + return $block_parameters; + + $style = !empty($parameters['style']); + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 5; + $type = !empty($parameters['type']) ? (int) $parameters['type'] : 0; + $sort = !empty($parameters['sort']); + + if (!isset($mod)) + { + if (file_exists($sourcedir . '/shop')) + $mod = 'smf_shop'; + else + $mod = ''; + } + + if (empty($mod)) + { + echo ' + ', $txt['error_sp_no_shop_found']; + return; + } + elseif ($mod == 'smf_shop') + { + require_once($sourcedir . '/shop/Shop-Subs.php'); + loadLanguage('Shop'); + + if (empty($style)) + { + $request = $smcFunc['db_query']('',' + SELECT id_member, real_name, {raw:type} AS money + FROM {db_prefix}members + ORDER BY money DESC + LIMIT {int:limit}', + array( + 'type' => $type == 0 ? '(money + moneyBank)' : ($type == 1 ? 'money' : 'moneyBank'), + 'limit' => $limit, + ) + ); + $members = array(); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($row['id_member'])) + $colorids[$row['id_member']] = $row['id_member']; + + $members[] = array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], + 'link' => '' . $row['real_name'] . '', + 'money' => formatMoney($row['money']), + ); + } + $smcFunc['db_free_result']($request); + + if (empty($members)) + { + echo ' + ', $txt['error_sp_no_members_found']; + return; + } + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($members as $k => $p) + { + if (!empty($color_profile[$p['id']]['link'])) + $members[$k]['link'] = $color_profile[$p['id']]['link']; + } + } + + echo ' + '; + } + else + { + $request = $smcFunc['db_query']('',' + SELECT id, name, price, image + FROM {db_prefix}shop_items + WHERE stock > {int:none} + ORDER BY {raw:type} + LIMIT {int:limit}', + array( + 'none' => 0, + 'type' => $sort ? 'RAND()' : 'id DESC', + 'limit' => $limit, + ) + ); + $items = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $items[] = array( + 'id' => $row['id'], + 'name' => $row['name'], + 'href' => $scripturl . '?action=shop;do=buy2;id=' . $row['id'], + 'link' => '' . $txt['shop_buynow'] . '', + 'price' => $row['price'], + 'image' => empty($row['image']) ? '' : '' . $row['name'] . '', + ); + } + $smcFunc['db_free_result']($request); + + if (empty($items)) + { + echo ' + ', $txt['error_sp_no_items_found']; + return; + } + else + $item_count = count($items); + + echo ' + '; + + $count = 0; + foreach ($items as $item) + echo ' + + + + '; + + echo ' +
+ ', $item['image'], ' + + ', $item['name'], '
+ ', $txt['shop_price'], ': ', $item['price'], '
+ ', $context['user']['money'] < $item['price'] ? sprintf($txt['shop_need'], formatMoney($item['price'] - $context['user']['money'])) : $item['link'], ' +
'; + } + } +} + +function sp_blog($parameters, $id, $return_parameters = false) +{ + global $smcFunc, $scripturl, $user_info, $modSettings; + global $context, $boarddir, $sourcedir, $txt, $color_profile; + static $mod; + + $block_parameters = array( + 'limit' => 'int', + 'type' => 'select', + 'sort' => 'select', + ); + + if ($return_parameters) + return $block_parameters; + + $limit = empty($parameters['limit']) ? 5 : (int) $parameters['limit']; + $type = empty($parameters['type']) ? 0 : 1; + $sort = empty($parameters['sort']) ? 0 : 1; + + if (!isset($mod)) + { + if (file_exists($boarddir . '/zCommunity')) + $mod = 'zcommunity'; + elseif (file_exists($sourcedir . '/Blog.php')) + $mod = 'smfblog'; + else + $mod = ''; + } + + if (empty($mod)) + { + echo ' + ', $txt['error_sp_no_blog_found']; + return; + } + elseif ($mod == 'zcommunity') + { + $request = $smcFunc['db_query']('',' + SELECT b.blog_id, b.blog_owner, b.member_groups, bs.users_allowed_access, bs.hideBlog AS hidden + FROM {db_prefix}blog_blogs AS b + LEFT JOIN {db_prefix}blog_settings AS bs ON (bs.blog_id = b.blog_id)', + array( + ) + ); + $visible_blogs = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $can_see_this_blog = false; + + if (empty($row['hidden'])) + { + $allowedGroups = !empty($row['member_groups']) ? explode(',', $row['member_groups']) : array(); + $can_see_this_blog = count(array_intersect($user_info['groups'], $allowedGroups)) > 0; + + if (empty($can_see_this_blog) && !empty($row['users_allowed_access']) && !$user_info['is_guest']) + { + $users_allowed = !empty($row['users_allowed_access']) ? explode(',', $row['users_allowed_access']) : array(); + $can_see_this_blog = in_array($context['user']['id'], $users_allowed); + } + } + + if ($user_info['is_admin'] || ($context['user']['id'] == $row['blog_owner'])) + $can_see_this_blog = true; + + if ($can_see_this_blog) + $visible_blogs[] = $row['blog_id']; + } + $smcFunc['db_free_result']($request); + + if (empty($visible_blogs)) + { + echo ' + ', $txt['error_sp_no_blogs_found']; + return; + } + + if (empty($type)) + { + $request = $smcFunc['db_query']('',' + SELECT t.article_id, t.subject + FROM {db_prefix}blog_articles AS t + LEFT JOIN {db_prefix}blog_settings AS bs ON (bs.blog_id = t.blog_id) + WHERE t.blog_id IN ({array_int:visible_blogs}) + AND ((t.approved = 1) OR (bs.articles_require_approval = 0)) + ORDER BY {raw:type} + LIMIT {int:limit}', + array( + 'visible_blogs' => $visible_blogs, + 'type' => $sort ? 'RAND()' : 't.article_id DESC', + 'limit' => $limit, + ) + ); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $articles[] = array( + 'id' => $row['article_id'], + 'subject' => strip_tags($row['subject']), + 'link' => '' . $row['subject'] . '', + ); + } + $smcFunc['db_free_result']($request); + + if (empty($articles)) + { + echo ' + ', $txt['error_sp_no_articles_found']; + return; + } + + echo ' + '; + } + else + { + $request = $smcFunc['db_query']('',' + SELECT + b.blog_id, b.name, t.article_id, t.subject, m.id_member, m.real_name, + m.avatar, a.id_attach, a.attachment_type, a.filename + FROM {db_prefix}blog_blogs AS b + LEFT JOIN {db_prefix}blog_articles AS t ON (t.article_id = b.last_article_id) + LEFT JOIN {db_prefix}members AS m ON (m.id_member = b.blog_owner) + LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member) + WHERE b.blog_id IN ({array_int:visible_blogs}) + ORDER BY {raw:type} + LIMIT {int:limit}', + array( + 'visible_blogs' => $visible_blogs, + 'type' => $sort ? 'RAND()' : 'b.last_article_id DESC', + 'limit' => $limit, + ) + ); + $blogs = array(); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($row['id_member'])) + $colorids[$row['id_member']] = $row['id_member']; + + 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 = ''; + } + + $blogs[] = array( + 'id' => $row['blog_id'], + 'name' => $row['name'], + 'href' => $scripturl . '?blog=' . $row['blog_id'] . '.0', + 'link' => '' . $row['name'] . '', + 'article' => array( + 'id' => $row['article_id'], + 'subject' => strip_tags($row['subject']), + 'link' => '' . $row['subject'] . '', + ), + 'owner' => array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], + 'link' => '' . $row['real_name'] . '', + ), + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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']) + ), + ); + } + $smcFunc['db_free_result']($request); + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($blogs as $k => $p) + { + if (!empty($color_profile[$p['owner']['id']]['link'])) + $blogs[$k]['owner']['link'] = $color_profile[$p['owner']['id']]['link']; + } + } + + echo ' + '; + + foreach ($blogs as $blog) + echo ' + + + + '; + + echo ' +
', !empty($blog['avatar']['href']) ? ' + ' . $blog['name'] . '' : '', ' + + ', $blog['owner']['link'], '
+ ', $blog['article']['link'], ' +
'; + } + } + elseif ($mod == 'smfblog') + { + $request = $smcFunc['db_query']('',' + SELECT b.id_board + FROM {db_prefix}boards AS b + WHERE {query_see_board} + AND b.is_blog = {int:is_blog}', + array( + 'is_blog' => 1, + ) + ); + $visible_blogs = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + $visible_blogs[] = $row['id_board']; + $smcFunc['db_free_result']($request); + + if (empty($visible_blogs)) + { + echo ' + ', $txt['error_sp_no_blogs_found']; + return; + } + + if (empty($type)) + { + $request = $smcFunc['db_query']('',' + SELECT t.id_topic, m.subject + FROM {db_prefix}topics AS t + INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg) + WHERE t.id_board IN ({array_int:visible_blogs})' . ($modSettings['postmod_active'] ? ' + AND t.approved = {int:is_approved}' : '') . ' + ORDER BY {raw:type} + LIMIT {int:limit}', + array( + 'visible_blogs' => $visible_blogs, + 'is_approved' => 1, + 'type' => $sort ? 'RAND()' : 't.id_topic DESC', + 'limit' => $limit, + ) + ); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + censorText($row['subject']); + + $articles[] = array( + 'id' => $row['id_topic'], + 'subject' => $row['subject'], + 'link' => '' . $row['subject'] . '', + ); + } + $smcFunc['db_free_result']($request); + + if (empty($articles)) + { + echo ' + ', $txt['error_sp_no_articles_found']; + return; + } + + echo ' + '; + } + else + { + $request = $smcFunc['db_query']('',' + SELECT b.id_board, b.blog_alias, b.name, MAX(t.id_topic) AS id_topic + FROM {db_prefix}boards AS b + INNER JOIN {db_prefix}topics AS t ON (t.id_board = b.id_board) + WHERE b.id_board IN ({array_int:visible_blogs})' . ($modSettings['postmod_active'] ? ' + AND t.approved = {int:is_approved}' : '') . ' + GROUP BY b.id_board + ORDER BY {raw:type} + LIMIT {int:limit}', + array( + 'visible_blogs' => $visible_blogs, + 'is_approved' => 1, + 'type' => $sort ? 'RAND()' : 'b.id_board DESC', + 'limit' => $limit, + ) + ); + $blogs = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $blogs[$row['id_board']] = array( + 'id' => $row['id_board'], + 'alias' => $row['blog_alias'], + 'name' => $row['name'], + 'href' => $scripturl . '?action=blog;sa=view_blog;name=' . $row['blog_alias'], + 'link' => '' . $row['name'] . '', + ); + $articles[] = $row['id_topic']; + } + $smcFunc['db_free_result']($request); + + if (empty($articles)) + { + echo ' + ', $txt['error_sp_no_articles_found']; + return; + } + + $request = $smcFunc['db_query']('',' + SELECT + t.id_board, t.id_topic, m.subject, mem.id_member, mem.real_name, + mem.avatar, a.id_attach, a.attachment_type, a.filename + 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}members AS mem ON (mem.id_member = t.id_member_started) + LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = t.id_member_started) + WHERE t.id_topic IN ({array_int:blog_articles}) + LIMIT {int:limit}', + array( + 'blog_articles' => $articles, + 'limit' => count($articles), + ) + ); + $colorids = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($row['id_member'])) + $colorids[$row['id_member']] = $row['id_member']; + + 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 = ''; + } + + censorText($row['subject']); + + $blogs[$row['id_board']] += array( + 'article' => array( + 'id' => $row['id_topic'], + 'subject' => $row['subject'], + 'link' => '' . $row['subject'] . '', + ), + 'owner' => array( + 'id' => $row['id_member'], + 'name' => $row['real_name'], + 'href' => $scripturl . '?action=profile;u=' . $row['id_member'], + 'link' => '' . $row['real_name'] . '', + ), + 'avatar' => array( + 'name' => $row['avatar'], + 'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '' : '') : (stristr($row['avatar'], 'http://') ? '' : ''), + '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']) + ), + ); + } + $smcFunc['db_free_result']($request); + + if (!empty($colorids) && sp_loadColors($colorids) !== false) + { + foreach ($blogs as $k => $p) + { + if (!empty($color_profile[$p['owner']['id']]['link'])) + $blogs[$k]['owner']['link'] = $color_profile[$p['owner']['id']]['link']; + } + } + + echo ' + '; + + foreach ($blogs as $blog) + echo ' + + + + '; + + echo ' +
', !empty($blog['avatar']['href']) ? ' + ' . $blog['name'] . '' : '', ' + + ', $blog['owner']['link'], '
+ ', $blog['article']['link'], ' +
'; + } + } +} + +function sp_menu($parameters, $id, $return_parameters = false) +{ + global $context; + + $block_parameters = array(); + + if ($return_parameters) + return $block_parameters; + + if (empty($context['menu_buttons'])) + setupMenuContext(); + + echo ' + '; +} + +function sp_bbc($parameters, $id, $return_parameters = false) +{ + $block_parameters = array( + 'content' => 'bbc', + ); + + if ($return_parameters) + return $block_parameters; + + $content = !empty($parameters['content']) ? $parameters['content'] : ''; + + echo ' + ', parse_bbc($content); +} + +function sp_html($parameters, $id, $return_parameters = false) +{ + $block_parameters = array( + 'content' => 'textarea', + ); + + if ($return_parameters) + return $block_parameters; + + $content = !empty($parameters['content']) ? $parameters['content'] : ''; + + echo ' + ', un_htmlspecialchars($content); +} + +function sp_php($parameters, $id, $return_parameters = false) +{ + $block_parameters = array( + 'content' => 'textarea', + ); + + if ($return_parameters) + return $block_parameters; + + $content = !empty($parameters['content']) ? $parameters['content'] : ''; + + $content = trim(un_htmlspecialchars($content)); + if (substr($content, 0, 5) == '') + $content = substr($content, 0, -2); + + eval($content); +} + +?> \ No newline at end of file diff --git a/Sources/PortalMain.php b/Sources/PortalMain.php new file mode 100644 index 0000000..a2a0593 --- /dev/null +++ b/Sources/PortalMain.php @@ -0,0 +1,81 @@ + 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'; +} + +?> \ No newline at end of file diff --git a/Sources/PortalPages.php b/Sources/PortalPages.php new file mode 100644 index 0000000..195d312 --- /dev/null +++ b/Sources/PortalPages.php @@ -0,0 +1,74 @@ + $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'; +} + +?> \ No newline at end of file diff --git a/Sources/PortalShoutbox.php b/Sources/PortalShoutbox.php new file mode 100644 index 0000000..bf1c3b2 --- /dev/null +++ b/Sources/PortalShoutbox.php @@ -0,0 +1,131 @@ + 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']; +} + +?> \ No newline at end of file diff --git a/Sources/QueryString.php b/Sources/QueryString.php index 5376d13..413dd68 100644 --- a/Sources/QueryString.php +++ b/Sources/QueryString.php @@ -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 . '(?:;|&|&))((?: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 . '(?:;|&|&))((?: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. diff --git a/Sources/Recent.php b/Sources/Recent.php index 78ef826..1aeb3c2 100644 --- a/Sources/Recent.php +++ b/Sources/Recent.php @@ -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' => '' . $row['cname'] . '' + 'href' => $scripturl . '?action=forum#c' . $row['id_cat'], + 'link' => '' . $row['cname'] . '' ), '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 ); } diff --git a/Sources/Subs-BoardIndex.php b/Sources/Subs-BoardIndex.php index fcae2c6..848c4a6 100644 --- a/Sources/Subs-BoardIndex.php +++ b/Sources/Subs-BoardIndex.php @@ -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']) ? '+' : '', - 'href' => $scripturl . '#c' . $row_board['id_cat'], + 'href' => $scripturl . '?action=forum#c' . $row_board['id_cat'], 'boards' => array(), 'new' => false ); diff --git a/Sources/Subs-Boards.php b/Sources/Subs-Boards.php index 5500dc1..c069d05 100644 --- a/Sources/Subs-Boards.php +++ b/Sources/Subs-Boards.php @@ -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') { diff --git a/Sources/Subs-Portal.php b/Sources/Subs-Portal.php new file mode 100644 index 0000000..db4b189 --- /dev/null +++ b/Sources/Subs-Portal.php @@ -0,0 +1,1441 @@ + $get_value) + $get_string .= $get_var . (!empty($get_value) ? '=' . $get_value : '') . ';'; + redirectexit(substr($get_string, 0, -1)); + } + return; + } + + if (!$standalone) + { + require_once($sourcedir . '/PortalBlocks.php'); + + if (SMF != 'SSI') + require_once($boarddir . '/SSI.php'); + + loadTemplate('Portal'); + loadLanguage('SPortal', sp_languageSelect('SPortal')); + + if (!empty($modSettings['sp_maintenance']) && !allowedTo('sp_admin')) + $modSettings['sp_portal_mode'] = 0; + + if (empty($modSettings['sp_standalone_url'])) + $modSettings['sp_standalone_url'] = ''; + + if ($modSettings['sp_portal_mode'] == 3) + $context += array( + 'portal_url' => $modSettings['sp_standalone_url'], + 'page_title' => $context['forum_name'], + ); + else + $context += array( + 'portal_url' => $scripturl, + ); + + if ($modSettings['sp_portal_mode'] == 1) + $context['linktree'][0] = array( + 'url' => $scripturl . '?action=forum', + 'name' => $context['forum_name'], + ); + + // If you want to remove Forum link when it is + // alone, take out the following two comment lines. + //if (empty($context['linktree'][1])) + // $context['linktree'] = array(); + + if (!empty($context['linktree']) && $modSettings['sp_portal_mode'] == 1) + foreach ($context['linktree'] as $key => $tree) + if (strpos($tree['url'], '#c') !== false && strpos($tree['url'], 'action=forum#c') === false) + $context['linktree'][$key]['url'] = str_replace('#c', '?action=forum#c', $tree['url']); + } + + $context['standalone'] = $standalone; + + // Load the headers if necessary. + sportal_init_headers(); + + $context['SPortal']['sides'] = array( + 5 => array( + 'id' => '5', + 'name' => 'header', + 'active' => true, + ), + 1 => array( + 'id' => '1', + 'name' => 'left', + 'active' => !empty($modSettings['showleft']), + ), + 2 => array( + 'id' => '2', + 'name' => 'top', + 'active' => true, + ), + 3 => array( + 'id' => '3', + 'name' => 'bottom', + 'active' => true, + ), + 4 => array( + 'id' => '4', + 'name' => 'right', + 'active' => !empty($modSettings['showright']), + ), + 6 => array( + 'id' => '6', + 'name' => 'footer', + 'active' => true, + ), + ); + + $blocks = getBlockInfo(null, null, true, true, true); + $context['SPortal']['blocks'] = array(); + foreach ($blocks as $block) + { + if (!$context['SPortal']['sides'][$block['column']]['active']) + continue; + + $block['style'] = sportal_parse_style('explode', $block['style'], true); + + $context['SPortal']['sides'][$block['column']]['last'] = $block['id']; + $context['SPortal']['blocks'][$block['column']][] = $block; + } + + foreach($context['SPortal']['sides'] as $side) + { + if (empty($context['SPortal']['blocks'][$side['id']])) + $context['SPortal']['sides'][$side['id']]['active'] = false; + + $context['SPortal']['sides'][$side['id']]['collapsed'] = $context['user']['is_guest'] ? !empty($_COOKIE['sp_' . $side['name']]) : !empty($options['sp_' . $side['name']]); + } + + if (!empty($context['template_layers']) && !in_array('portal', $context['template_layers'])) + $context['template_layers'][] = 'portal'; +} + +// Deals with the initialization of SimplePortal headers. +function sportal_init_headers() +{ + global $context, $settings, $modSettings; + static $initialized; + + if (!empty($initialized)) + return; + + $context['html_headers'] .= ' + + '; + + $initialized = true; +} + +function sportal_catch_action() +{ + global $sourcedir, $modSettings, $board, $topic, $context; + + if (isset($_GET['about:sinan'])) + return 'BookOfSinan'; + + if (empty($context['disable_sp'])) + { + if (empty($board) && empty($topic) && empty($_GET['page']) && $modSettings['sp_portal_mode'] == 1) + { + require_once($sourcedir . '/PortalMain.php'); + return 'sportal_main'; + } + elseif (empty($board) && empty($topic) && !empty($_GET['page'])) + { + require_once($sourcedir . '/PortalPages.php'); + return 'sportal_pages'; + } + } + + return false; +} + +// This function, returns all of the information about particular blocks. +function getBlockInfo($column_id = null, $block_id = null, $state = null, $show = null, $permission = null) +{ + global $smcFunc, $context, $settings, $options, $txt; + + $query = array(); + $parameters = array(); + if (!empty($column_id)) + { + $query[] = 'spb.col = {int:col}'; + $parameters['col'] = !empty($column_id) ? $column_id : 0; + } + if (!empty($block_id)) + { + $query[] = 'spb.id_block = {int:id_block}'; + $parameters['id_block'] = !empty($block_id) ? $block_id : 0; + } + if (!empty($state)) + { + $query[] = 'spb.state = {int:state}'; + $parameters['state'] = 1; + } + + $request = $smcFunc['db_query']('',' + SELECT + spb.id_block, spb.label, spb.type, spb.col, spb.row, spb.permission_set, + spb.groups_allowed, spb.groups_denied, spb.state, spb.force_view, spb.display, + spb.display_custom, spb.style, spp.variable, spp.value + FROM {db_prefix}sp_blocks AS spb + LEFT JOIN {db_prefix}sp_parameters AS spp ON (spp.id_block = spb.id_block)' . (!empty($query) ? ' + WHERE ' . implode(' AND ', $query) : '') . ' + ORDER BY spb.col, spb.row', + $parameters + ); + + $return = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($show) && !getShowInfo($row['id_block'], $row['display'], $row['display_custom'])) + continue; + + if (!empty($permission) && !sp_allowed_to('block', $row['id_block'], $row['permission_set'], $row['groups_allowed'], $row['groups_denied'])) + continue; + + if (!isset($return[$row['id_block']])) + { + $return[$row['id_block']] = array( + 'id' => $row['id_block'], + 'label' => $row['label'], + 'type' => $row['type'], + 'type_text' => !empty($txt['sp_function_' . $row['type'] . '_label']) ? $txt['sp_function_' . $row['type'] . '_label'] : $txt['sp_function_unknown_label'], + 'column' => $row['col'], + 'row' => $row['row'], + 'permission_set' => $row['permission_set'], + 'groups_allowed' => $row['groups_allowed'] !== '' ? explode(',', $row['groups_allowed']) : array(), + 'groups_denied' => $row['groups_denied'] !== '' ? explode(',', $row['groups_denied']) : array(), + 'state' => empty($row['state']) ? 0 : 1, + 'force_view' => $row['force_view'], + 'display' => $row['display'], + 'display_custom' => $row['display_custom'], + 'style' => $row['style'], + 'collapsed' => $context['user']['is_guest'] ? !empty($_COOKIE['sp_block_' . $row['id_block']]) : !empty($options['sp_block_' . $row['id_block']]), + 'parameters' => array(), + ); + } + + if (!empty($row['variable'])) + $return[$row['id_block']]['parameters'][$row['variable']] = $row['value']; + } + $smcFunc['db_free_result']($request); + + return $return; +} + +// Function to get a block's display/show information. +function getShowInfo($block_id = null, $display = null, $custom = null) +{ + global $smcFunc, $context, $modSettings; + static $variables; + + // Do we have the display info? + if ($display === null || $custom === null) + { + // Make sure that its an integer. + $block_id = (int) $block_id; + + // We need an ID. + if (empty($block_id)) + return false; + + // Get the info. + $result = $smcFunc['db_query']('',' + SELECT display, display_custom + FROM {db_prefix}sp_blocks + WHERE id_block = {int:id_block} + LIMIT 1', + array( + 'id_block' => $block_id, + ) + ); + list ($display, $custom) = $smcFunc['db_fetch_row']($result); + $smcFunc['db_free_result']($result); + } + + if (!empty($_GET['page']) && (empty($context['current_action']) || $context['current_action'] == 'portal')) + $page_info = sportal_get_pages($_GET['page'], true, true); + + // Some variables for ease. + $action = !empty($context['current_action']) ? $context['current_action'] : ''; + $sub_action = !empty($context['current_subaction']) ? $context['current_subaction'] : ''; + $board = !empty($context['current_board']) ? 'b' . $context['current_board'] : ''; + $topic = !empty($context['current_topic']) ? 't' . $context['current_topic'] : ''; + $page = !empty($page_info['id']) ? 'p' . $page_info['id'] : ''; + $portal = (empty($action) && empty($sub_action) && empty($board) && empty($topic) && SMF != 'SSI' && $modSettings['sp_portal_mode'] == 1) || !empty($context['standalone']) ? true : false; + + // Will hopefully get larger in the future. + $portal_actions = array( + 'articles' => true, + 'start' => true, + 'theme' => true, + 'PHPSESSID' => true, + 'wwwRedirect' => true, + 'www' => true, + 'variant' => true, + 'language' => true, + ); + + // Set some action exceptions. + $exceptions = array( + 'post' => array('announce', 'editpoll', 'emailuser', 'post2', 'sendtopic'), + 'register' => array('activate', 'coppa'), + 'forum' => array('collapse'), + 'admin' => array('credits', 'theme', 'viewquery', 'viewsmfile'), + 'moderate' => array('groups'), + 'login' => array('reminder'), + 'profile' => array('trackip', 'viewprofile'), + ); + + // Still, we might not be in portal! + if (!empty($_GET) && empty($context['standalone'])) + foreach ($_GET as $key => $value) + { + if (preg_match('~^news\d+$~', $key)) + continue; + + if (!isset($portal_actions[$key])) + $portal = false; + elseif (is_array($portal_actions[$key]) && !in_array($value, $portal_actions[$key])) + $portal = false; + } + + // Set the action to more known one. + foreach ($exceptions as $key => $exception) + if (in_array($action, $exception)) + $action = $key; + + // Take care of custom actions. + $special = array(); + $exclude = array(); + if (!empty($custom)) + { + // Complex display options first... + if (substr($custom, 0, 4) === '$php') + { + if (!isset($variables)) + { + $variables = array( + '{$action}' => "'$action'", + '{$sa}' => "'$sub_action'", + '{$board}' => "'$board'", + '{$topic}' => "'$topic'", + '{$page}' => "'$page'", + '{$portal}' => $portal, + ); + } + + return @eval(str_replace(array_keys($variables), array_values($variables), un_htmlspecialchars(substr($custom, 4))) . ';'); + } + + $custom = explode(',', $custom); + + // This is special... + foreach ($custom as $key => $value) + { + $name = ''; + $item = ''; + + // Is this a weird action? + if ($value[0] == '~') + { + @list($name, $item) = explode('|', substr($value, 1)); + + if (empty($item)) + $special[$name] = true; + else + $special[$name][] = $item; + } + + // Might be excluding something! + elseif ($value[0] == '-') + { + // We still may have weird things... + if ($value[1] == '~') + { + @list($name, $item) = explode('|', substr($value, 2)); + + if (empty($item)) + $exclude['special'][$name] = true; + else + $exclude['special'][$name][] = $item; + } + else + $exclude['regular'][] = substr($value, 1); + } + } + + // Add what we have to main variable. + if (!empty($display)) + $display = $display . ',' . implode(',', $custom); + else + $display = $custom; + } + + // We don't want to show it on this action/page/board? + if (!empty($exclude['regular']) && count(array_intersect(array($action, $page, $board), $exclude['regular'])) > 0) + return false; + + // Maybe we don't want to show it in somewhere special. + if (!empty($exclude['special'])) + foreach ($exclude['special'] as $key => $value) + if (isset($_GET[$key])) + if (is_array($value) && !in_array($_GET[$key], $value)) + continue; + else + return false; + + // If no display info and/or integration disabled and we are on portal; show it! + if ((empty($display) || empty($modSettings['sp_enableIntegration'])) && $portal) + return true; + // No display info and/or integration disabled and no portal; no need... + elseif (empty($display) || empty($modSettings['sp_enableIntegration'])) + return false; + // Get ready for real action if you haven't yet. + elseif (!is_array($display)) + $display = explode(',', $display); + + // Did we disable all blocks for this action? + if (!empty($modSettings['sp_' . $action . 'IntegrationHide'])) + return false; + // If we will display show the block. + elseif (in_array('all', $display)) + return true; + // If we are on portal, show portal blocks; if we are on forum, show forum blocks. + elseif (($portal && (in_array('portal', $display) || in_array('sportal', $display))) || (!$portal && in_array('sforum', $display))) + return true; + elseif (!empty($board) && (in_array('allboard', $display) || in_array($board, $display))) + return true; + elseif (!empty($action) && $action != 'portal' && (in_array('allaction', $display) || in_array($action, $display))) + return true; + elseif (!empty($page) && (in_array('allpages', $display) || in_array($page, $display))) + return true; + elseif (empty($action) && empty($board) && empty($_GET['page']) && !$portal && ($modSettings['sp_portal_mode'] == 2 || $modSettings['sp_portal_mode'] == 3) && in_array('forum', $display)) + return true; + + // For mods using weird urls... + foreach ($special as $key => $value) + if (isset($_GET[$key])) + if (is_array($value) && !in_array($_GET[$key], $value)) + continue; + else + return true; + + // Ummm, no block! + return false; +} + +function sp_allowed_to($type, $id, $set = null, $allowed = null, $denied = null) +{ + global $smcFunc, $user_info; + static $cache, $types; + + if (!isset($types)) + { + $types = array( + 'block' => array( + 'table' => 'blocks', + 'id' => 'id_block', + ), + 'page' => array( + 'table' => 'pages', + 'id' => 'id_page', + ), + 'shoutbox' => array( + 'table' => 'shoutboxes', + 'id' => 'id_shoutbox', + ), + ); + } + + if (empty($id) || empty($type) || !isset($types[$type])) + return false; + + if (!isset($set, $allowed, $denied)) + { + $request = $smcFunc['db_query']('',' + SELECT permission_set, groups_allowed, groups_denied + FROM {db_prefix}sp_{raw:table} + WHERE {raw:id} = {int:id_item} + LIMIT {int:limit}', + array( + 'table' => $types[$type]['table'], + 'id' => $types[$type]['id'], + 'id_item' => $id, + 'limit' => 1, + ) + ); + list ($set, $allowed, $denied) = $smcFunc['db_fetch_row']($request); + $smcFunc['db_free_result']($request); + } + + $result = false; + $cache_name = md5(implode(':', array($set, $allowed, $denied))); + + if (isset($cache[$cache_name])) + $result = $cache[$cache_name]; + else + { + switch ($set) + { + case 3: + $result = true; + break; + case 2: + $result = empty($user_info['is_guest']); + break; + case 1: + $result = !empty($user_info['is_guest']); + break; + case 0: + if (!empty($denied) && count(array_intersect($user_info['groups'], explode(',', $denied))) > 0) + $result = false; + elseif (!empty($allowed) && count(array_intersect($user_info['groups'], explode(',', $allowed))) > 0) + $result = true; + break; + default: + break; + } + + $cache[$cache_name] = $result; + } + + return $result; +} + +function BookOfSinan() +{ + global $context, $scripturl; + + echo ' + + + The Book of Sinan, ', @$_GET['verse'] == '3:17' ? '3:17' : '1:15', ' + + + + +
'; + if (@$_GET['verse'] == '3:17') + echo ' + ...And suddenly the dream was over. Whether this was an end or a new start, however, was a mystery to all... +
'; + else + echo ' + ...It all started with a noob. He united simplicity with power, and achieved the ultimate power of simplicity.
This power lead him to the domination of World of Blocks... + '; + echo ' +
'; + if (@$_GET['verse'] == '3:17') + echo ' + from The Book of Sinan, 3:17'; + else + echo ' + from The Book of Sinan, 1:15'; + echo ' +
+ +'; + + obExit(false); +} + +function sp_query_string($tourniquet) +{ + global $sportal_version, $context, $modSettings; + + $fix = str_replace('{version}', $sportal_version, 'SimplePortal {version} © 2008-2012, SimplePortal'); + + if ((SMF == 'SSI' && empty($context['standalone'])) || empty($context['template_layers']) || WIRELESS || empty($modSettings['sp_portal_mode']) || strpos($tourniquet, $fix) !== false) + return $tourniquet; + + $finds = array( + ', Simple Machines LLC', + ', Simple Machines', + 'class="copywrite"', + 'class="copyright"', + ); + $replaces = array( + ', Simple Machines LLC
' . $fix, + ', Simple Machines
' . $fix, + 'class="copywrite" style="line-height: 1em;"', + 'class="copyright" style="line-height: 1.5em;"', + ); + + $tourniquet = str_replace($finds, $replaces, $tourniquet); + + if (strpos($tourniquet, $fix) === false) + { + $fix = '
' . $fix . '
'; + $tourniquet = preg_replace('~\s*~', $fix, $tourniquet); + } + + return $tourniquet; +} + +/* +This is a simple function that return nothing if the language file exist and english if it not exists +This will help to make it possible to load each time the english language! +*/ +function sp_languageSelect($template_name) +{ + global $user_info, $language, $settings, $context; + global $sourcedir; + static $already_loaded = array(); + + if(isset($already_loaded[$template_name])) + return $already_loaded[$template_name]; + + $lang = isset($user_info['language']) ? $user_info['language'] : $language; + + // Make sure we have $settings - if not we're in trouble and need to find it! + if (empty($settings['default_theme_dir'])) + { + require_once($sourcedir . '/ScheduledTasks.php'); + loadEssentialThemeData(); + } + + // For each file open it up and write it out! + $allTemplatesExists = array(); + foreach (explode('+', $template_name) as $template) + { + // Obviously, the current theme is most important to check. + $attempts = array( + array($settings['theme_dir'], $template, $lang, $settings['theme_url']), + array($settings['theme_dir'], $template, $language, $settings['theme_url']), + ); + + // Do we have a base theme to worry about? + if (isset($settings['base_theme_dir'])) + { + $attempts[] = array($settings['base_theme_dir'], $template, $lang, $settings['base_theme_url']); + $attempts[] = array($settings['base_theme_dir'], $template, $language, $settings['base_theme_url']); + } + + // Fallback on the default theme if necessary. + $attempts[] = array($settings['default_theme_dir'], $template, $lang, $settings['default_theme_url']); + $attempts[] = array($settings['default_theme_dir'], $template, $language, $settings['default_theme_url']); + + // Try to find the language file. + $allTemplatesExists[$template] = false; + $already_loaded[$template] = 'english'; + foreach ($attempts as $k => $file) { + if (file_exists($file[0] . '/languages/' . $file[1] . '.' . $file[2] . '.php')) + { + $already_loaded[$template] = ''; + $allTemplatesExists[$template] = true; + break; + } + } + } + //So all need to be true that it work ;) + foreach($allTemplatesExists as $exist) + if(!$exist) + { + $already_loaded[$template_name] = 'english'; + return 'english'; + } + + //Everthing is fine, let's go back :D + $already_loaded[$template_name] = ''; + return ''; +} + +function sp_loadCalendarData($type, $low_date, $high_date = false) +{ + global $sourcedir; + static $loaded; + + if(!isset($loaded)) + { + require_once($sourcedir . '/Subs-Calendar.php'); + + $loaded = array( + 'getEvents' => 'getEventRange', + 'getBirthdays' => 'getBirthdayRange', + 'getHolidays' => 'getHolidayRange', + ); + } + + if (!empty($loaded[$type])) + return $loaded[$type]($low_date, ($high_date === false ? $low_date : $high_date)); + else + return array(); +} + +// This is a small script to load colors for SPortal. +function sp_loadColors($users = array()) +{ + global $color_profile, $smcFunc, $scripturl, $modSettings; + + // This is for later, if you like to disable colors ;) + if (!empty($modSettings['sp_disableColor'])) + return false; + + // Can't just look for no users. :P + if (empty($users)) + return false; + + // MemberColorLink compatible, cache more data, handle also some special member color link colors + if (!empty($modSettings['MemberColorLinkInstalled'])) + { + $colorData = load_onlineColors($users); + + // This happen only on not existing Members... but given ids... + if(empty($colorData)) + return false; + + $loaded_ids = array_keys($colorData); + + foreach($loaded_ids as $id) + { + if (!empty($id) && !isset($color_profile[$id]['link'])) + { + $color_profile[$id]['link'] = $colorData[$id]['colored_link']; + $color_profile[$id]['colored_name'] = $colorData[$id]['colored_name']; + } + } + return empty($loaded_ids) ? false : $loaded_ids; + } + + // Make sure it's an array. + $users = !is_array($users) ? array($users) : array_unique($users); + + //Check up the array :) + foreach($users as $k => $u) + { + $u = (int) $u; + + if (empty($u)) + unset($users[$k]); + else + $users[$k] = $u; + } + + $loaded_ids = array(); + // Is this a totally new variable? + if (empty($color_profile)) + $color_profile = array(); + // Otherwise, we will need to do some reformating of the old data. + else + { + foreach ($users as $k => $u) + if (isset($color_profile[$u])) + { + $loaded_ids[] = $u; + unset($users[$k]); + } + } + + // Make sure that we have some users. + if (empty($users)) + return empty($loaded_ids) ? false : $loaded_ids; + + // Correct array pointer for the user + reset($users); + // Load the data. + $request = $smcFunc['db_query']('',' + SELECT + mem.id_member, mem.member_name, mem.real_name, mem.id_group, + mg.online_color AS member_group_color, pg.online_color AS post_group_color + FROM {db_prefix}members AS mem + LEFT JOIN {db_prefix}membergroups AS pg ON (pg.id_group = mem.id_post_group) + LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group) + WHERE mem.id_member '.((count($users) == 1) ? '= {int:current}' : 'IN ({array_int:users})'), + array( + 'users' => $users, + 'current' => (int) current($users), + ) + ); + + // Go through each of the users. + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + $loaded_ids[] = $row['id_member']; + $color_profile[$row['id_member']] = $row; + $onlineColor = !empty($row['member_group_color']) ? $row['member_group_color'] : $row['post_group_color']; + $color_profile[$row['id_member']]['color'] = $onlineColor; + $color_profile[$row['id_member']]['link'] = '' . $row['real_name'] . ''; + $color_profile[$row['id_member']]['colored_name'] = (!empty($onlineColor) ? '' : '' ) . $row['real_name'] . (!empty($onlineColor) ? '' : ''); + } + $smcFunc['db_free_result']($request); + + // Return the necessary data. + return empty($loaded_ids) ? false : $loaded_ids; +} + +function sp_embed_image($name, $alt = '', $width = null, $height = null, $title = true, $id = null) +{ + global $modSettings, $settings, $txt; + static $default_alt, $randomizer, $randomizer2; + + if (!isset($default_alt)) + { + $default_alt = array( + 'dot' => $txt['sp-dot'], + 'stars' => $txt['sp-star'], + 'arrow' => $txt['sp-arrow'], + 'modify' => $txt['modify'], + 'delete' => $txt['delete'], + 'delete_small' => $txt['delete'], + 'history' => $txt['sp_shoutbox_history'], + 'refresh' => $txt['sp_shoutbox_refresh'], + 'smiley' => $txt['sp_shoutbox_smiley'], + 'style' => $txt['sp_shoutbox_style'], + 'bin' => $txt['sp_shoutbox_prune'], + 'move' => $txt['sp_move'], + ); + } + + if (!isset($randomizer) || $randomizer > 7) + $randomizer = 0; + $randomizer++; + + if (empty($alt) && isset($default_alt[$name])) + $alt = $default_alt[$name]; + + if ($title === true) + $title = !empty($alt) ? $alt : ''; + + if (empty($alt)) + $alt = $name; + + if (in_array($name, array('dot', 'star')) && empty($modSettings['sp_disable_random_bullets'])) + $name .= $randomizer; + + $image = '' . $alt . ''; + + return $image; +} + +function sportal_parse_style($action, $setting = '', $process = false) +{ + global $smcFunc; + static $process_cache; + + if ($action == 'implode') + { + $style = ''; + $style_parameters = array( + 'title_default_class', + 'title_custom_class', + 'title_custom_style', + 'body_default_class', + 'body_custom_class', + 'body_custom_style', + 'no_title', + 'no_body', + ); + + foreach ($style_parameters as $parameter) + if (isset($_POST[$parameter])) + $style .= $parameter . '~' . $smcFunc['htmlspecialchars']($smcFunc['htmltrim']($_POST[$parameter]), ENT_QUOTES) . '|'; + else + $style .= $parameter . '~|'; + + if (!empty($style)) + $style = substr($style, 0, -1); + } + elseif ($action == 'explode') + { + if (!empty($setting)) + { + $temp = explode('|', $setting); + $style = array(); + + foreach ($temp as $item) + { + list ($key, $value) = explode('~', $item); + $style[$key] = $value; + } + } + else + { + $style = array( + 'title_default_class' => 'catbg', + 'title_custom_class' => '', + 'title_custom_style' => '', + 'body_default_class' => 'windowbg', + 'body_custom_class' => '', + 'body_custom_style' => '', + 'no_title' => false, + 'no_body' => false, + ); + } + + if ($process && !isset($process_cache[$setting])) + { + if (empty($style['no_title'])) + { + $style['title']['class'] = $style['title_default_class']; + + if (!empty($style['title_custom_class'])) + $style['title']['class'] .= ' ' . $style['title_custom_class']; + + $style['title']['style'] = $style['title_custom_style']; + } + + if (empty($style['no_body'])) + $style['body']['class'] = $style['body_default_class']; + else + $style['body']['class'] = ''; + + if (!empty($style['body_custom_class'])) + $style['body']['class'] .= ' ' . $style['body_custom_class']; + + $style['body']['style'] = $style['body_custom_style']; + + $process_cache[$setting] = $style; + } + elseif ($process) + $style = $process_cache[$setting]; + } + + return $style; +} + +function sportal_get_pages($page_id = null, $active = false, $allowed = false) +{ + global $smcFunc; + + $query = array(); + $parameters = array(); + + if (!empty($page_id) && is_numeric($page_id)) + { + $query[] = 'id_page = {int:page_id}'; + $parameters['page_id'] = (int) $page_id; + } + elseif (!empty($page_id)) + { + $query[] = 'namespace = {string:namespace}'; + $parameters['namespace'] = $page_id; + } + if (!empty($active)) + { + $query[] = 'status = {int:status}'; + $parameters['status'] = 1; + } + + $request = $smcFunc['db_query']('',' + SELECT + id_page, namespace, title, body, type, permission_set, + groups_allowed, groups_denied, views, style, status + FROM {db_prefix}sp_pages' . (!empty($query) ? ' + WHERE ' . implode(' AND ', $query) : '') . ' + ORDER BY title', + $parameters + ); + $return = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($allowed) && !sp_allowed_to('page', $row['id_page'], $row['permission_set'], $row['groups_allowed'], $row['groups_denied'])) + continue; + + $return[$row['id_page']] = array( + 'id' => $row['id_page'], + 'page_id' => $row['namespace'], + 'title' => $row['title'], + 'body' => $row['body'], + 'type' => $row['type'], + 'permission_set' => $row['permission_set'], + 'groups_allowed' => $row['groups_allowed'] !== '' ? explode(',', $row['groups_allowed']) : array(), + 'groups_denied' => $row['groups_denied'] !== '' ? explode(',', $row['groups_denied']) : array(), + 'views' => $row['views'], + 'style' => $row['style'], + 'status' => $row['status'], + ); + } + $smcFunc['db_free_result']($request); + + return !empty($page_id) ? current($return) : $return; +} + +function sportal_parse_page($body, $type) +{ + if (strtolower($body) === 'el psy congroo') + echo 'Steins;Gate'; + elseif ($type == 'bbc') + echo parse_bbc($body); + elseif ($type == 'html') + echo un_htmlspecialchars($body); + elseif ($type == 'php') + { + $body = trim(un_htmlspecialchars($body)); + $body = trim($body, ''); + eval($body); + } +} + +function sportal_get_shoutbox($shoutbox_id = null, $active = false, $allowed = false) +{ + global $smcFunc; + + $query = array(); + $parameters = array(); + + if ($shoutbox_id !== null) + { + $query[] = 'id_shoutbox = {int:shoutbox_id}'; + $parameters['shoutbox_id'] = $shoutbox_id; + } + if (!empty($active)) + { + $query[] = 'status = {int:status}'; + $parameters['status'] = 1; + } + + $request = $smcFunc['db_query']('',' + SELECT + id_shoutbox, name, permission_set, groups_allowed, groups_denied, + moderator_groups, warning, allowed_bbc, height, num_show, num_max, + refresh, reverse, caching, status, num_shouts, last_update + FROM {db_prefix}sp_shoutboxes' . (!empty($query) ? ' + WHERE ' . implode(' AND ', $query) : '') . ' + ORDER BY name', + $parameters + ); + $return = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + if (!empty($allowed) && !sp_allowed_to('shoutbox', $row['id_shoutbox'], $row['permission_set'], $row['groups_allowed'], $row['groups_denied'])) + continue; + + $return[$row['id_shoutbox']] = array( + 'id' => $row['id_shoutbox'], + 'name' => $row['name'], + 'permission_set' => $row['permission_set'], + 'groups_allowed' => $row['groups_allowed'] !== '' ? explode(',', $row['groups_allowed']) : array(), + 'groups_denied' => $row['groups_denied'] !== '' ? explode(',', $row['groups_denied']) : array(), + 'moderator_groups' => $row['moderator_groups'] !== '' ? explode(',', $row['moderator_groups']) : array(), + 'warning' => $row['warning'], + 'allowed_bbc' => explode(',', $row['allowed_bbc']), + 'height' => $row['height'], + 'num_show' => $row['num_show'], + 'num_max' => $row['num_max'], + 'refresh' => $row['refresh'], + 'reverse' => $row['reverse'], + 'caching' => $row['caching'], + 'status' => $row['status'], + 'num_shouts' => $row['num_shouts'], + 'last_update' => $row['last_update'], + ); + } + $smcFunc['db_free_result']($request); + + return !empty($shoutbox_id) ? current($return) : $return; +} + +function sportal_get_shouts($shoutbox, $parameters) +{ + global $smcFunc, $scripturl, $context, $user_info, $modSettings, $options, $txt; + + $shoutbox = !empty($shoutbox) ? (int) $shoutbox : 0; + $start = !empty($parameters['start']) ? (int) $parameters['start'] : 0; + $limit = !empty($parameters['limit']) ? (int) $parameters['limit'] : 20; + $bbc = !empty($parameters['bbc']) ? $parameters['bbc'] : array(); + $reverse = !empty($parameters['reverse']); + $cache = !empty($parameters['cache']); + $can_delete = !empty($parameters['can_moderate']); + + if (!empty($start) || !$cache || ($shouts = cache_get_data('shoutbox_shouts-' . $shoutbox, 240)) === null) + { + $request = $smcFunc['db_query']('', ' + SELECT + sh.id_shout, sh.body, IFNULL(mem.id_member, 0) AS id_member, + IFNULL(mem.real_name, sh.member_name) AS member_name, sh.log_time, + mg.online_color AS member_group_color, pg.online_color AS post_group_color + FROM {db_prefix}sp_shouts AS sh + LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = sh.id_member) + LEFT JOIN {db_prefix}membergroups AS pg ON (pg.id_group = mem.id_post_group) + LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = mem.id_group) + WHERE sh.id_shoutbox = {int:id_shoutbox} + ORDER BY sh.id_shout DESC + LIMIT {int:start}, {int:limit}', + array( + 'id_shoutbox' => $shoutbox, + 'start' => $start, + 'limit' => $limit, + ) + ); + $shouts = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + { + // Disable the aeva mod for the shoutbox. + $context['aeva_disable'] = true; + $online_color = !empty($row['member_group_color']) ? $row['member_group_color'] : $row['post_group_color']; + $shouts[$row['id_shout']] = array( + 'id' => $row['id_shout'], + 'author' => array( + 'id' => $row['id_member'], + 'name' => $row['member_name'], + 'link' => $row['id_member'] ? ('' . $row['member_name'] . '') : $row['member_name'], + 'color' => $online_color, + ), + 'time' => $row['log_time'], + 'text' => parse_bbc($row['body'], true, '', $bbc), + ); + } + $smcFunc['db_free_result']($request); + + if (empty($start) && $cache) + cache_put_data('shoutbox_shouts-' . $shoutbox, $shouts, 240); + } + + foreach ($shouts as $shout) + { + if (preg_match('~^@(.+?): ~' . ($context['utf8'] ? 'u' : ''), $shout['text'], $target) && $smcFunc['strtolower']($target[1]) !== $smcFunc['strtolower']($user_info['name']) && $shout['author']['id'] != $user_info['id'] && !$user_info['is_admin']) + { + unset($shouts[$shout['id']]); + continue; + } + + $shouts[$shout['id']] += array( + 'is_me' => preg_match('~^\* ' . preg_quote($shout['author']['name'], '~') . '.+$~', $shout['text']) != 0, + 'delete_link' => $can_delete ? '' . sp_embed_image('delete_small') . ' ' : '', + 'delete_link_js' => $can_delete ? '' . sp_embed_image('delete_small') . ' ' : '', + ); + + $shouts[$shout['id']]['text'] = str_replace(':jade:', 'Jade!', $shouts[$shout['id']]['text']); + $shouts[$shout['id']]['time'] = timeformat($shouts[$shout['id']]['time']); + $shouts[$shout['id']]['text'] = preg_replace('~()~', '$1span$2', $shouts[$shout['id']]['text']); + $shouts[$shout['id']]['text'] = preg_replace('~]+>)([^<]+)~', '', $shouts[$shout['id']]['text']); + $shouts[$shout['id']]['text'] = censorText($shouts[$shout['id']]['text']); + + if (!empty($modSettings['enable_buddylist']) && !empty($options['posts_apply_ignore_list']) && in_array($shout['author']['id'], $context['user']['ignoreusers'])) + $shouts[$shout['id']]['text'] = '[' . $txt['sp_shoutbox_show_ignored'] . ']'; + } + + if ($reverse) + $shouts = array_reverse($shouts); + + return $shouts; +} + +function sportal_create_shout($shoutbox, $shout) +{ + global $smcFunc, $user_info; + + if ($user_info['is_guest']) + return false; + + if (empty($shoutbox)) + return false; + + if (trim(strip_tags(parse_bbc($shout, false), '')) === '') + return false; + + $smcFunc['db_insert']('', + '{db_prefix}sp_shouts', + array( + 'id_shoutbox' => 'int', + 'id_member' => 'int', + 'member_name' => 'string', + 'log_time' => 'int', + 'body' => 'string', + ), + array( + $shoutbox['id'], + $user_info['id'], + $user_info['name'], + time(), + $shout, + ), + array('id_shout') + ); + + $shoutbox['num_shouts']++; + if ($shoutbox['num_shouts'] > $shoutbox['num_max']) + { + $request = $smcFunc['db_query']('',' + SELECT id_shout + FROM {db_prefix}sp_shouts + WHERE id_shoutbox = {int:shoutbox} + ORDER BY log_time + LIMIT {int:limit}', + array( + 'shoutbox' => $shoutbox['id'], + 'limit' => $shoutbox['num_shouts'] - $shoutbox['num_max'], + ) + ); + $old_shouts = array(); + while ($row = $smcFunc['db_fetch_assoc']($request)) + $old_shouts[] = $row['id_shout']; + $smcFunc['db_free_result']($request); + + sportal_delete_shout($shoutbox['id'], $old_shouts, true); + } + else + sportal_update_shoutbox($shoutbox['id'], true); +} + +function sportal_delete_shout($shoutbox_id, $shouts, $prune = false) +{ + global $smcFunc; + + if (!is_array($shouts)) + $shouts = array($shouts); + + $smcFunc['db_query']('', ' + DELETE FROM {db_prefix}sp_shouts + WHERE id_shout IN ({array_int:shouts})', + array( + 'shouts' => $shouts, + ) + ); + + sportal_update_shoutbox($shoutbox_id, $prune ? count($shouts) - 1 : count($shouts)); +} + +function sportal_update_shoutbox($shoutbox_id, $num_shouts = 0) +{ + global $smcFunc; + + $smcFunc['db_query']('', ' + UPDATE {db_prefix}sp_shoutboxes + SET last_update = {int:time}' . ($num_shouts === 0 ? '' : ', + num_shouts = {raw:shouts}') . ' + WHERE id_shoutbox = {int:shoutbox}', + array( + 'shoutbox' => $shoutbox_id, + 'time' => time(), + 'shouts' => $num_shouts === true ? 'num_shouts + 1' : 'num_shouts - ' . $num_shouts, + ) + ); + + cache_put_data('shoutbox_shouts-' . $shoutbox_id, null, 240); +} + +function sp_prevent_flood($type, $fatal = true) +{ + global $smcFunc, $modSettings, $user_info, $txt; + + $limits = array( + 'spsbp' => 2, + ); + + if (!allowedTo('admin_forum')) + $time_limit = isset($limits[$type]) ? $limits[$type] : $modSettings['spamWaitTime']; + else + $time_limit = 2; + + $smcFunc['db_query']('', ' + DELETE FROM {db_prefix}log_floodcontrol + WHERE log_time < {int:log_time} + AND log_type = {string:log_type}', + array( + 'log_time' => time() - $time_limit, + 'log_type' => $type, + ) + ); + + $smcFunc['db_insert']('replace', + '{db_prefix}log_floodcontrol', + array('ip' => 'string-16', 'log_time' => 'int', 'log_type' => 'string'), + array($user_info['ip'], time(), $type), + array('ip', 'log_type') + ); + + if ($smcFunc['db_affected_rows']() != 1) + { + if ($fatal) + fatal_lang_error('error_sp_flood_' . $type, false, array($time_limit)); + else + return isset($txt['error_sp_flood_' . $type]) ? sprintf($txt['error_sp_flood_' . $type], $time_limit) : true; + } + + return false; +} + +?> \ No newline at end of file diff --git a/Sources/Subs-PortalAdmin.php b/Sources/Subs-PortalAdmin.php new file mode 100644 index 0000000..3c6695c --- /dev/null +++ b/Sources/Subs-PortalAdmin.php @@ -0,0 +1,548 @@ + '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' => '' . $row['name'] . '', + ), + '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) == '') + $code = substr($code, 0, -2); + + require_once($sourcedir . '/Subs-Package.php'); + + $content = ''; + + $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('~ (\d+)$~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; +} + +?> \ No newline at end of file diff --git a/Sources/Subs.php b/Sources/Subs.php index bc68c7d..9506aff 100644 --- a/Sources/Subs.php +++ b/Sources/Subs.php @@ -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 . '(?:;|&|&))((?: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 . '(?:;|&|&))((?: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')) diff --git a/Sources/Who.php b/Sources/Who.php index ec48f1c..016cd0b 100644 --- a/Sources/Who.php +++ b/Sources/Who.php @@ -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'))) { diff --git a/Themes/default/Display.template.php b/Themes/default/Display.template.php index b1492c1..7b0b5be 100644 --- a/Themes/default/Display.template.php +++ b/Themes/default/Display.template.php @@ -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 '
diff --git a/Themes/default/Portal.template.php b/Themes/default/Portal.template.php new file mode 100644 index 0000000..89dd16f --- /dev/null +++ b/Themes/default/Portal.template.php @@ -0,0 +1,246 @@ +'; + + if ($context['SPortal']['sides'][1]['active']) + echo ' + ', sp_embed_image($context['SPortal']['sides'][1]['collapsed'] ? 'expand' : 'collapse', '', null, null, true, 'sp_collapse_side1'), ''; + + if ($context['SPortal']['sides'][4]['active']) + echo ' + ', sp_embed_image($context['SPortal']['sides'][4]['collapsed'] ? 'expand' : 'collapse', '', null, null, true, 'sp_collapse_side4'), ''; + + echo ' +
'; + } + + if (!empty($context['SPortal']['blocks'][5])) + { + echo ' +
'; + + foreach ($context['SPortal']['blocks'][5] as $block) + template_block($block); + + echo ' +
'; + } + + echo ' + + '; + + if (!empty($modSettings['showleft']) && !empty($context['SPortal']['blocks'][1])) + { + echo ' + '; + } + + echo ' + '; + + if (!empty($modSettings['showright']) && !empty($context['SPortal']['blocks'][4])) + { + echo ' + '; + } + echo ' + +
'; + + if (!empty($context['SPortal']['blocks'][2])) + { + foreach ($context['SPortal']['blocks'][2] as $block) + template_block($block); + + if (empty($context['SPortal']['on_portal'])) + echo ' +
'; + } +} + +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 ' +
'; + + foreach ($context['SPortal']['blocks'][3] as $block) + template_block($block); + } + + echo ' +
'; + + if (!empty($context['SPortal']['blocks'][6])) + { + echo ' + +
'; + } +} + +function template_block($block) +{ + global $context, $modSettings, $txt; + + if (empty($block) || empty($block['type'])) + return; + + if ($block['type'] == 'sp_boardNews') + { + echo ' +
'; + + $block['type']($block['parameters'], $block['id']); + + echo ' +
'; + + 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 ' +
+
+ '; + + if (empty($block['style']['no_title'])) + { + echo ' + + + '; + } + + echo ' + + +
'; + + if (empty($block['force_view'])) + echo ' + *'; + + echo ' + ', parse_bbc($block['label']), ' +
'; + + $block['type']($block['parameters'], $block['id']); + + echo ' +
+
+
'; +} + +function template_block_curve($block) +{ + global $context, $modSettings, $settings; + + if (empty($block['style']['no_title'])) + { + echo ' +
+

'; + + if (empty($block['force_view'])) + echo ' + *'; + + echo ' + ', parse_bbc($block['label']), ' +

+
'; + } + + echo ' + '; + + if (strpos($block['style']['body']['class'], 'roundframe') !== false) + { + echo ' + '; + } + + echo ' + '; +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalAdmin.template.php b/Themes/default/PortalAdmin.template.php new file mode 100644 index 0000000..3d4bb59 --- /dev/null +++ b/Themes/default/PortalAdmin.template.php @@ -0,0 +1,313 @@ + +
'; + + if (isset($context['settings_title'])) + echo ' +
+

+ ', $context['settings_title'], ' +

+
'; + + if (!empty($context['settings_message'])) + echo ' +
', $context['settings_message'], '
'; + + $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 ' + + + + '; + } + + if ($config_var['type'] == 'title') + { + echo ' +
+

+ ', ($config_var['help'] ? '' . $txt['help'] . '' : ''), ' + ', $config_var['label'], ' +

+
'; + } + else + { + echo ' +

+ ', $config_var['label'], ' +

'; + } + + continue; + } + + if (!$is_open) + { + $is_open = true; + echo ' +
+ +
+
'; + } + + if (is_array($config_var)) + { + if (in_array($config_var['type'], array('message', 'warning'))) + { + echo ' + + ', $config_var['label'], ' + '; + } + else + { + echo ' + '; + + $javascript = $config_var['javascript']; + $disabled = !empty($config_var['disabled']) ? ' disabled="disabled"' : ''; + $subtext = !empty($config_var['subtext']) ? '
' . $config_var['subtext'] . '' : ''; + + if ($config_var['help']) + echo ' + ', $txt['help'], '', $subtext, ($config_var['type'] == 'password' ? '
' . $txt['admin_confirm_password'] . '' : ''), ' + '; + else + echo ' + ', $subtext, ($config_var['type'] == 'password' ? '
' . $txt['admin_confirm_password'] . '' : ''), ' + '; + + echo ' + ', + $config_var['preinput']; + + if ($config_var['type'] == 'check') + echo ' + '; + elseif ($config_var['type'] == 'select') + { + echo ' + '; + } + elseif ($config_var['type'] == 'large_text') + { + echo ' + '; + } + elseif ($config_var['type'] == 'var_message') + echo $config_var['var_message']; + elseif ($config_var['type'] == 'multicheck') + { + foreach($config_var['subsettings'] as $name => $title) + { + echo ' + + ', $title, '
'; + } + } + else + echo ' + '; + + echo ' + ', $config_var['postinput'], ' + '; + } + } + + else + { + if ($config_var == '') + echo ' +
+
+
'; + else + echo ' + ' . $config_var . ''; + } + } + + if ($is_open) + echo ' +
'; + + if (empty($context['settings_save_dont_show'])) + echo ' +

+ +

'; + + if ($is_open) + echo ' +
+ +
'; + + echo ' + +
+ +
'; +} + +function template_information() +{ + global $context, $txt; + + if ($context['in_admin']) + { + echo ' +
+
+
+

+ ', $txt['sp-info_live'], ' +

+
+
+ +
+
', $txt['sp-info_no_live'], '
+
+ +
+
+
+
+

+ ', $txt['sp-info_general'], ' +

+
+
+ +
+ ', $txt['sp-info_versions'], ':
+ ', $txt['sp-info_your_version'], ': + ', $context['sp_version'], '
+ ', $txt['sp-info_current_version'], ': + ??
+ ', $txt['sp-info_managers'], ': + ', implode(', ', $context['sp_managers']), ' +
+ +
+
+
+ + + '; + } + + echo ' +
+

+ ', $txt['sp-info_title'], ' +

+
+
+ +
'; + + foreach ($context['sp_credits'] as $section) + { + if (isset($section['pretext'])) + echo ' +

', $section['pretext'], '

'; + + foreach ($section['groups'] as $group) + { + if (empty($group['members'])) + continue; + + echo ' +

'; + + if (isset($group['title'])) + echo ' + ', $group['title'], ': '; + + echo implode(', ', $group['members']), ' +

'; + } + + + if (isset($section['posttext'])) + echo ' +

', $section['posttext'], '

'; + } + + echo ' +
+

', sprintf($txt['sp-info_contribute'], 'http://www.simpleportal.net/index.php?page=contribute'), '

+
+ +
'; +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalAdminArticles.template.php b/Themes/default/PortalAdminArticles.template.php new file mode 100644 index 0000000..689f155 --- /dev/null +++ b/Themes/default/PortalAdminArticles.template.php @@ -0,0 +1,405 @@ + +
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+ + + '; + + foreach ($context['columns'] as $column) + { + if ($column['selected']) + echo ' + '; + elseif ($column['sortable']) + echo ' + '; + else + echo ' + '; + } + + echo ' + + + + '; + + if (empty($context['total_articles'])) + { + echo ' + + + '; + } + + while ($article = $context['get_article']()) + { + echo ' + + + + + + + + + + '; + } + + echo ' + +
+ ', $column['label'], '  + + ', $column['link'], ' + + ', $column['label'], ' + + +
 
', $article['topic']['link'], '', $article['board']['link'], '', $article['poster']['link'], '', $article['message']['time'], '', $article['category']['name'], '', empty($article['article']['approved']) ? sp_embed_image('deactive', $txt['sp-stateNo']) : sp_embed_image('active', $txt['sp-stateYes']), '', $article['edit'], ' ', $article['delete'], '
+
+
+ +
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+ +
+ '; +} + +function template_article_add() +{ + global $context, $settings, $options, $txt, $scripturl; + + echo ' +
+
+
+

+ ', $txt['help'], '  + ', $txt['sp-articlesAdd'], ' +

+
+
+ +
+
+
+ ', $txt['help'], ' + +
+
+ +
+
+
+ +
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+
+ +
'; + + if (!empty($context['boards']) && count($context['boards']) > 1) + { + echo ' +
+
+ ', $txt['help'], ' + +
+
+ +
+
'; + } + + echo ' +
+ ', $txt['help'], ' + ', $txt['topics'], ':'; + + if (!empty($context['topics'])) + { + echo ' +
+
    '; + + foreach ($context['topics'] as $topic) + echo ' +
  • + + ' . $topic['subject'] . ' ' . $txt['started_by'] . ' ' . $topic['poster']['link'] . ' +
  • '; + echo ' +
+
+ +
'; + } + else + echo ' + ', $txt['sp-adminArticleAddNoTopics'], ' +
'; + + echo ' +
+ +
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+ + + '; +} + +function template_article_edit() +{ + global $context, $settings, $options, $scripturl, $txt, $modSettings; + + echo ' +
+
+
+

+ ', $txt['help'], ' + ', $txt['sp-articlesEdit'], ' +

+
+
+ +
+
+
+ ', $txt['help'], ' + +
+
+ +
+
+ ', $txt['help'], ' + +
+
+ +
+
+
+ +
+
+ +
+ + +
+
'; +} + +function template_category_list() +{ + global $context, $settings, $options, $scripturl, $txt; + + echo ' + + + '; + + foreach ($context['columns'] as $column) + { + echo ' + '; + } + + echo ' + + + '; + + if (empty($context['categories'])) + { + echo ' + + + '; + } + + foreach($context['categories'] as $category) + { + echo ' + + + + + + + '; + } + echo ' + +
+ ', $column['label'], ' +
 
', !empty($category['picture']['href']) ? $category['picture']['image'] : '', '', $category['name'], '', $category['articles'], '', empty($category['publish']) ? sp_embed_image('deactive', $txt['sp-stateNo']) : sp_embed_image('active', $txt['sp-stateYes']), '', sp_embed_image('modify'), ' ', sp_embed_image('delete'), '
'; +} + +function template_category_edit() +{ + global $context, $settings, $scripturl, $txt, $modSettings; + + echo ' +
+
+
+

+ ', $txt['help'], ' + ', $context['page_title'], ' +

+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+ + '; + + if ($context['category_action'] == 'edit') + echo ' + '; + + echo ' +
+
'; +} + +function template_category_delete() +{ + global $context, $settings, $options, $scripturl, $txt, $modSettings; + + echo ' +
+
+
+

+ ', $txt['help'], ' + ', $txt['sp-categoriesDelete'], ' +

+
+
+ +
+
+ ', sprintf($txt['sp-categoriesDeleteCount'], $context['category_info']['articles']), '
'; + + if (!empty($context['list_categories'])) + { + echo ' + ', $txt['sp-categoriesDeleteOption1'], ' +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
'; + } + else + { + echo ' + ', $txt['sp-categoriesDeleteOption2'], ' +
'; + } + + echo ' +
+ +
+
+ +
+ + + + '; +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalAdminBlocks.template.php b/Themes/default/PortalAdminBlocks.template.php new file mode 100644 index 0000000..22ef983 --- /dev/null +++ b/Themes/default/PortalAdminBlocks.template.php @@ -0,0 +1,569 @@ +'; + + if ($context['block_move']) + echo ' +
+

', $context['move_title'], ' [', $txt['sp-blocks_cancel_moving'], ']', '

+
'; + + foreach($context['sides'] as $id => $side) + { + echo ' + + + + '; + + if ($context['block_move']) + echo ' + '; + + foreach ($context['columns'] as $column) + echo ' + '; + + echo ' + + + '; + + if (empty($context['blocks'][$side['name']])) + { + echo ' + + + '; + } + + foreach($context['blocks'][$side['name']] as $block) + { + echo ' + '; + + if ($context['block_move']) + echo ' + '; + + echo ' + + + + '; + } + + if ($context['block_move'] && (empty($side['last']) || $context['block_move'] != $side['last'])) + { + echo ' + + + + + + '; + } + + echo ' + +
', $txt['sp-adminColumnMove'], '', $column['label'], '
', $txt['error_sp_no_block'], '
', $block['id'] != $context['block_move'] ? $block['move_insert'] : '', '', $block['id'] == $context['block_move'] ? '' . $block['label'] . '' : $block['label'], '', $block['type_text'], '', implode(' ', $block['actions']), '
', sp_embed_image('arrow', $txt['sp-blocks_move_here']), '
'; + } + + echo ' + '; +} + +function template_block_edit() +{ + global $context, $settings, $options, $scripturl, $txt, $helptxt, $modSettings; + + if (!empty($context['SPortal']['preview'])) + { + echo ' +
'; + + template_block($context['SPortal']['block']); + + echo ' +
'; + } + + echo ' +
+
+
+

+ ', $txt['help'], ' + ', $context['SPortal']['is_new'] ? $txt['sp-blocksAdd'] : $txt['sp-blocksEdit'], ' +

+
+
+ +
+
+
+ ', $txt['sp-adminColumnType'], ': +
+
+ ', $context['SPortal']['block']['type_text'], ' +
+
+ +
+
+ +
+
+ ', $txt['help'], ' + ', $txt['sp_admin_blocks_col_permissions'], ': +
+
+ +
+
+ ', $txt['sp_admin_blocks_col_custom_permissions'], ': +
+
+ + + + + + '; + + 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 ' + + + + + + '; + } + + echo ' +
', $txt['sp_admin_blocks_custom_permissions_membergroup'], ' + ', $txt['sp_admin_blocks_custom_permissions_allowed_short'], '', $txt['sp_admin_blocks_custom_permissions_disallowed_short'], '', $txt['sp_admin_blocks_custom_permissions_denied_short'], '
', $label, '
+
'; + + foreach ($context['SPortal']['block']['options'] as $name => $type) + { + if (empty($context['SPortal']['block']['parameters'][$name])) + $context['SPortal']['block']['parameters'][$name] = ''; + + echo ' +
'; + + if (!empty($helptxt['sp_param_' . $context['SPortal']['block']['type'] . '_' . $name])) + echo ' + ', $txt['help'], ''; + + echo ' + +
+
'; + + if ($type == 'bbc') + { + echo ' +
+
+
+
+
+ ', template_control_richedit($context['SPortal']['bbc'], 'sp_rich_smileys', 'sp_rich_bbc'), ' + + +
+
'; + } + elseif ($type == 'boards' || $type == 'board_select') + { + echo ' + '; + + if ($type == 'boards') + echo ' + '; + + foreach ($context['SPortal']['block']['board_options'][$name] as $option) + echo ' + '; + echo ' + '; + } + elseif ($type == 'int') + echo ' + '; + elseif ($type == 'text') + echo ' + '; + elseif ($type == 'check') + echo ' + '; + elseif ($type == 'select') + { + $options = explode('|', $txt['sp_param_' . $context['SPortal']['block']['type'] . '_' . $name . '_options']); + + echo ' + '; + } + elseif (is_array($type)) + { + echo ' + '; + } + elseif ($type == 'textarea') + { + echo ' + +
+
+ + + +
+
'; + } + + if ($type != 'bbc') + echo ' + '; + } + + if (empty($context['SPortal']['block']['column'])) + { + echo ' +
+ +
+
+ +
'; + } + + if (count($context['SPortal']['block']['list_blocks']) > 1) + { + echo ' +
+ ', $txt['sp-blocksRow'], ': +
+
+ + +
'; + } + + if ($context['SPortal']['block']['type'] != 'sp_boardNews') + { + echo ' +
+ +
+
+ +
'; + } + + echo ' +
+ +
+
+ +
+
+
+ +
+
+ +
'; + + if (!empty($context['SPortal']['block']['column'])) + echo ' + '; + + echo ' + + + '; + + if (!empty($modSettings['sp_enableIntegration'])) + { + echo ' +
+
+

+ ', $txt['help'], ' + ', $txt['sp-blocksDisplayOptions'], ' +

+
+
+ +
+ ', $txt['sp-blocksAdvancedOptions'], ' + ', $txt['sp-blocksShowBlock'], ' + + +
+ +
+
+ +
'; + } + + $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 ' +
+
+

+ ', $txt['help'], ' + ', $txt['sp-blocksStyleOptions'], ' +

+
+
+ +
'; + + foreach ($style_sections as $section => $float) + { + echo ' +
'; + + foreach ($style_types as $type => $label) + { + echo ' +
+ ', $txt['sp-blocks' . ucfirst($section) . $label], ': +
+
'; + + if ($type == 'default') + { + echo ' + '; + } + else + echo ' + '; + + echo ' +
'; + } + + echo ' +
+ ', $txt['sp-blocksNo' . ucfirst($section)], ': +
+
+ +
+
'; + } + + echo ' + +
+ +
+
+ +
'; + } + + echo ' +
+
+ '; +} + +function template_block_select_type() +{ + global $context, $scripturl, $settings, $txt; + + echo ' +
+
+

+ ', $txt['help'], ' + ', $txt['sp-blocksSelectType'], ' +

+
+
+ + '; + + foreach($context['SPortal']['block_types'] as $index => $type) + { + if ($index != 0 && $index % 3 == 0) + { + echo ' + + '; + } + + echo ' + '; + } + + echo ' + +
+
+ +
+ +

', $txt['sp_function_' . $type['function'] . '_desc'], '

+
+ +
+
+
+ +
+ +
+ +
'; + + if (!empty($context['SPortal']['block']['column'])) + echo ' + '; + + echo ' + +
+
'; +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalAdminPages.template.php b/Themes/default/PortalAdminPages.template.php new file mode 100644 index 0000000..752666d --- /dev/null +++ b/Themes/default/PortalAdminPages.template.php @@ -0,0 +1,338 @@ + +
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+ + + '; + + foreach ($context['columns'] as $column) + { + if ($column['selected']) + echo ' + '; + elseif ($column['sortable']) + echo ' + '; + else + echo ' + '; + } + + echo ' + + + + '; + + if (empty($context['pages'])) + { + echo ' + + + '; + } + + foreach ($context['pages'] as $page) + { + echo ' + + + + + + + + + '; + } + + echo ' + +
+ ', $column['label'], '  + + ', $column['link'], ' + + ', $column['label'], ' + + +
', $txt['sp_error_no_pages'], '
', $page['link'], '', $page['page_id'], '', $page['type_text'], '', $page['views'], '', $page['status_image'], '', implode(' ', $page['actions']), '
+
+
+ +
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+ +
+ '; +} + +function template_pages_edit() +{ + global $context, $settings, $options, $scripturl, $txt, $helptxt, $modSettings; + + if (!empty($context['SPortal']['preview'])) + { + echo ' +
'; + + template_view_page(); + + echo ' +
'; + } + + echo ' +
+
+
+

+ ', $txt['sp_admin_pages_general'], ' +

+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ ', $txt['help'], ' + +
+
+ +
+
+ ', $txt['sp_admin_pages_col_custom_permissions'], ': +
+
+ + + + + + '; + + 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 ' + + + + + + '; + } + + echo ' +
', $txt['sp_admin_pages_custom_permissions_membergroup'], ' + ', $txt['sp_admin_pages_custom_permissions_allowed_short'], '', $txt['sp_admin_pages_custom_permissions_disallowed_short'], '', $txt['sp_admin_pages_custom_permissions_denied_short'], '
', $label, '
+
+
+ +
+
+ +
+
+ +
+
+
+
+ ', $txt['sp_admin_pages_col_body'], ': +
+
+
+
+
+ + +
', template_control_richedit($context['post_box_name'], 'sp_rich_smileys', 'sp_rich_bbc'), '
+
+
+ +
+
+ +
'; + + $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 ' +
+
+

+ ', $txt['sp_admin_pages_style'], ' +

+
+
+ +
'; + + foreach ($style_sections as $section => $float) + { + echo ' +
'; + + foreach ($style_types as $type => $label) + { + echo ' +
+ ', $txt['sp-blocks' . ucfirst($section) . $label], ': +
+
'; + + if ($type == 'default') + { + echo ' + '; + } + else + echo ' + '; + + echo ' +
'; + } + + echo ' +
+ ', $txt['sp-blocksNo' . ucfirst($section)], ': +
+
+ +
+
'; + } + + echo ' +
+ +
+
+ +
+ + +
+
+ '; +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalAdminShoutbox.template.php b/Themes/default/PortalAdminShoutbox.template.php new file mode 100644 index 0000000..92eb58c --- /dev/null +++ b/Themes/default/PortalAdminShoutbox.template.php @@ -0,0 +1,339 @@ + +
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+ + + '; + + foreach ($context['columns'] as $column) + { + if ($column['selected']) + echo ' + '; + elseif ($column['sortable']) + echo ' + '; + else + echo ' + '; + } + + echo ' + + + + '; + + if (empty($context['shoutboxes'])) + { + echo ' + + + '; + } + + foreach ($context['shoutboxes'] as $shoutbox) + { + echo ' + + + + + + + + '; + } + + echo ' + +
+ ', $column['label'], '  + + ', $column['link'], ' + + ', $column['label'], ' + + +
', $txt['sp_error_no_shoutbox'], '
', $shoutbox['name'], '', $shoutbox['shouts'], '', $shoutbox['caching'] ? $txt['sp_yes'] : $txt['sp_no'], '', $shoutbox['status_image'], '', implode(' ', $shoutbox['actions']), '
+
+
+ +
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+ +
+ '; +} + +function template_shoutbox_edit() +{ + global $context, $settings, $options, $scripturl, $txt, $helptxt, $modSettings; + + echo ' +
+
+
+

+ ', $context['page_title'], ' +

+
+
+ +
+
+
+ +
+
+ +
+
+ ', $txt['help'], ' + +
+
+ +
+
+ ', $txt['sp_admin_shoutbox_col_custom_permissions'], ': +
+
+ + + + + + '; + + 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 ' + + + + + + '; + } + + echo ' +
', $txt['sp_admin_shoutbox_custom_permissions_membergroup'], ' + ', $txt['sp_admin_shoutbox_custom_permissions_allowed_short'], '', $txt['sp_admin_shoutbox_custom_permissions_disallowed_short'], '', $txt['sp_admin_shoutbox_custom_permissions_denied_short'], '
', $label, '
+
+
+ ', $txt['sp_admin_shoutbox_col_moderators'], ': +
+
+
+ ', $txt['avatar_select_permission'], ' +
    '; + + foreach ($context['moderator_groups'] as $group) + { + echo ' +
  • '; + } + echo ' +
  • +
+
+ + +
+
+ ', $txt['help'], ' + +
+
+ +
+
+ ', $txt['help'], ' + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+ + +
+
+ '; +} + +function template_shoutbox_prune() +{ + global $context, $scripturl, $settings, $txt; + + echo ' +
+
+
+

+ ', $context['page_title'], ' +

+
+
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+ +
+ + +
+
+ + '; +} + +function template_shoutbox_block_redirect() +{ + global $context; + + echo ' +
+
+

+ ', $context['page_title'], ' +

+
+
+ +
+ ', $context['redirect_message'], ' +
+ +
+
'; +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalArticles.template.php b/Themes/default/PortalArticles.template.php new file mode 100644 index 0000000..323866f --- /dev/null +++ b/Themes/default/PortalArticles.template.php @@ -0,0 +1,189 @@ + + + + + + + + + + + + +
', $article['message']['icon'], '', $article['topic']['link'], '
'; + + if (!empty($modSettings['articleavatar']) && $article['poster']['avatar']['name'] !== null && !empty($article['poster']['avatar']['href'])) + echo ' + ', $article['poster']['name'], ' +
', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], '
', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '
'; + else + echo ' +
', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '
'; + + echo ' +

', !empty($article['category']['picture']['href']) ? '
' . $article['category']['name'] . '
' : '', $article['message']['body'], '

+
+
+
', $article['article']['link'], ' ', $article['article']['new_comment'], '
+
+ '; + } + + if (!empty($modSettings['articleperpage']) && !empty($context['page_index'])) + echo ' +
', $txt['sp-articlesPages'], ': ', $context['page_index'], '
'; +} + +function template_articles_curve() +{ + global $context, $txt, $modSettings, $scripturl; + + if (empty($modSettings['articleactive'])) + return; + + while ($article = $context['get_articles']()) + { + echo ' +
+

+ ', $article['message']['icon'], '', $article['topic']['link'], ' +

+
+
+ +
'; + + if (!empty($modSettings['articleavatar']) && $article['poster']['avatar']['name'] !== null && !empty($article['poster']['avatar']['href'])) + echo ' + ', $article['poster']['name'], ' +
', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], '
', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '
'; + else + echo ' +
', $article['message']['time'], ' ', $txt['by'], ' ', $article['poster']['link'], ' | ', $txt['sp-articlesViews'], ': ', $article['topic']['views'], ' | ', $txt['sp-articlesComments'], ': ', $article['topic']['replies'], '
'; + + echo ' +

', !empty($article['category']['picture']['href']) ? '
' . $article['category']['name'] . '
' : '', $article['message']['body'], '
+
', $article['article']['link'], ' ', $article['article']['new_comment'], '
+
+ +
'; + } + + if (!empty($modSettings['articleperpage']) && !empty($context['page_index'])) + echo ' +
', $txt['sp-articlesPages'], ': ', $context['page_index'], '
'; +} + +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 '
+ + + + + + + +
', $txt['sp-articlesAdd'], '
+
+ + + + + + + +
', $txt['sp-articlesCategory'], ': + +
+ + + +
+
'; +} + +function template_add_article_curve() +{ + global $context, $scripturl, $txt; + + echo ' +
+
+

+ ', $txt['sp-articlesAdd'], ' +

+
+
+ +
+
+
+ ', $txt['sp-articlesCategory'], ': +
+
+ +
+
+

+ +

+ + + +
+ +
+
'; +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalPages.template.php b/Themes/default/PortalPages.template.php new file mode 100644 index 0000000..af48321 --- /dev/null +++ b/Themes/default/PortalPages.template.php @@ -0,0 +1,96 @@ + + '; + + if (empty($context['SPortal']['page']['style']['no_title'])) + echo ' + + + '; + + echo ' + + + +
+ ', $context['SPortal']['page']['title'], ' +
'; + + sportal_parse_page($context['SPortal']['page']['body'], $context['SPortal']['page']['type']); + + echo ' +
+ '; +} + +function template_view_page_curve() +{ + global $context; + + if (empty($context['SPortal']['page']['style']['no_title'])) + { + echo ' +
+

+ ', $context['SPortal']['page']['title'], ' +

+
'; + } + + if (strpos($context['SPortal']['page']['style']['body']['class'], 'roundframe') !== false) + { + echo ' + '; + } + + echo ' +
'; + + if (empty($context['SPortal']['page']['style']['no_body'])) + { + echo ' + '; + } + + echo ' +
'; + + sportal_parse_page($context['SPortal']['page']['body'], $context['SPortal']['page']['type']); + + echo ' +
'; + + if (empty($context['SPortal']['page']['style']['no_body'])) + { + echo ' + '; + } + + echo ' +
'; + + if (strpos($context['SPortal']['page']['style']['body']['class'], 'roundframe') !== false) + { + echo ' + '; + } +} + +?> \ No newline at end of file diff --git a/Themes/default/PortalShoutbox.template.php b/Themes/default/PortalShoutbox.template.php new file mode 100644 index 0000000..8e51280 --- /dev/null +++ b/Themes/default/PortalShoutbox.template.php @@ -0,0 +1,277 @@ + +
+
+ ', $context['SPortal']['shoutbox']['name'], ' +
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+
+
    '; + + if (!empty($context['SPortal']['shouts_history'])) + foreach ($context['SPortal']['shouts_history'] as $shout) + echo ' + ', !$shout['is_me'] ? '
  • ' . $shout['author']['link'] . ':
  • ' : '', ' +
  • ', str_replace('ignored_shout', 'history_ignored_shout', $shout['text']), '
  • +
  • ', $shout['delete_link'], $shout['time'], '
  • '; + else + echo ' +
  • ', $txt['sp_shoutbox_no_shout'], '
  • '; + + echo ' +
+
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+
+ '; +} + +function template_shoutbox_all_curve() +{ + global $context, $scripturl, $settings, $txt; + + echo ' +
+

+ ', $context['SPortal']['shoutbox']['name'], ' +

+
+
+ +
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+
+
    '; + + if (!empty($context['SPortal']['shouts_history'])) + foreach ($context['SPortal']['shouts_history'] as $shout) + echo ' + ', !$shout['is_me'] ? '
  • ' . $shout['author']['link'] . ':
  • ' : '', ' +
  • ', str_replace('ignored_shout', 'history_ignored_shout', $shout['text']), '
  • +
  • ', $shout['delete_link'], $shout['time'], '
  • '; + else + echo ' +
  • ', $txt['sp_shoutbox_no_shout'], '
  • '; + + echo ' +
+
+
+ ', $txt['pages'], ': ', $context['page_index'], ' +
+
+ +
'; +} + +function template_shoutbox_embed($shoutbox) +{ + global $context, $scripturl, $settings, $txt; + + echo ' +
+
+ '; + + if ($context['can_shout']) + { + echo ' + + '; + } + + echo ' +
+
    '; + + if (!empty($shoutbox['warning'])) + echo ' +
  • ', $shoutbox['warning'], '
  • '; + + if (!empty($shoutbox['shouts'])) + foreach ($shoutbox['shouts'] as $shout) + echo ' +
  • ', !$shout['is_me'] ? '' . $shout['author']['link'] . ': ' : '', $shout['text'], '
    ', !empty($shout['delete_link_js']) ? '' . $shout['delete_link_js'] . '' : '' , '', $shout['time'], '
  • '; + else + echo ' +
  • ', $txt['sp_shoutbox_no_shout'], '
  • '; + + echo ' +
+
'; + + if ($context['can_shout']) + echo ' +
+ + +
'; + + echo ' +
+ + +
+ '; +} + +function template_shoutbox_xml() +{ + global $context, $txt; + + echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '> + + ', $context['SPortal']['shoutbox']['id'], ''; + + if ($context['SPortal']['updated']) + { + echo ' + 1 + ', empty($context['SPortal']['shouts']) ? $txt['sp_shoutbox_no_shout'] : 0, ' + ', !empty($context['SPortal']['shoutbox']['warning']) ? htmlspecialchars($context['SPortal']['shoutbox']['warning']) : 0, ' + ', !empty($context['SPortal']['shoutbox']['reverse']) ? 1 : 0, ''; + + foreach ($context['SPortal']['shouts'] as $shout) + echo ' + + ', $shout['id'], ' + ', htmlspecialchars($shout['author']['link']), ' + + ', htmlspecialchars(strip_tags($shout['time'])), ' + ', !empty($shout['delete_link_js']) ? htmlspecialchars($shout['delete_link_js']) : 0, ' + ', htmlspecialchars($shout['text']), ' + ', $shout['is_me'] ? 1 : 0, ' + '; + } + else + echo ' + 0'; + + echo ' +'; +} + +?> \ No newline at end of file diff --git a/Themes/default/css/portal.css b/Themes/default/css/portal.css new file mode 100644 index 0000000..7106831 --- /dev/null +++ b/Themes/default/css/portal.css @@ -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; +} \ No newline at end of file diff --git a/Themes/default/css/portal_rtl.css b/Themes/default/css/portal_rtl.css new file mode 100644 index 0000000..9ec6347 --- /dev/null +++ b/Themes/default/css/portal_rtl.css @@ -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; +} \ No newline at end of file diff --git a/Themes/default/images/admin/articles.png b/Themes/default/images/admin/articles.png new file mode 100644 index 0000000..fbb50e3 Binary files /dev/null and b/Themes/default/images/admin/articles.png differ diff --git a/Themes/default/images/admin/blocks.png b/Themes/default/images/admin/blocks.png new file mode 100644 index 0000000..c4cc6f1 Binary files /dev/null and b/Themes/default/images/admin/blocks.png differ diff --git a/Themes/default/images/admin/configuration.png b/Themes/default/images/admin/configuration.png new file mode 100644 index 0000000..73f7c13 Binary files /dev/null and b/Themes/default/images/admin/configuration.png differ diff --git a/Themes/default/images/admin/pages.png b/Themes/default/images/admin/pages.png new file mode 100644 index 0000000..75784b7 Binary files /dev/null and b/Themes/default/images/admin/pages.png differ diff --git a/Themes/default/images/admin/shoutbox.png b/Themes/default/images/admin/shoutbox.png new file mode 100644 index 0000000..3fc7877 Binary files /dev/null and b/Themes/default/images/admin/shoutbox.png differ diff --git a/Themes/default/images/sp/active.png b/Themes/default/images/sp/active.png new file mode 100644 index 0000000..3d80349 Binary files /dev/null and b/Themes/default/images/sp/active.png differ diff --git a/Themes/default/images/sp/add.png b/Themes/default/images/sp/add.png new file mode 100644 index 0000000..d571724 Binary files /dev/null and b/Themes/default/images/sp/add.png differ diff --git a/Themes/default/images/sp/admin.png b/Themes/default/images/sp/admin.png new file mode 100644 index 0000000..3683c23 Binary files /dev/null and b/Themes/default/images/sp/admin.png differ diff --git a/Themes/default/images/sp/arrow.png b/Themes/default/images/sp/arrow.png new file mode 100644 index 0000000..bd8b22a Binary files /dev/null and b/Themes/default/images/sp/arrow.png differ diff --git a/Themes/default/images/sp/attach.png b/Themes/default/images/sp/attach.png new file mode 100644 index 0000000..f552617 Binary files /dev/null and b/Themes/default/images/sp/attach.png differ diff --git a/Themes/default/images/sp/averages.png b/Themes/default/images/sp/averages.png new file mode 100644 index 0000000..670d38c Binary files /dev/null and b/Themes/default/images/sp/averages.png differ diff --git a/Themes/default/images/sp/bin.png b/Themes/default/images/sp/bin.png new file mode 100644 index 0000000..60ba330 Binary files /dev/null and b/Themes/default/images/sp/bin.png differ diff --git a/Themes/default/images/sp/birthday.png b/Themes/default/images/sp/birthday.png new file mode 100644 index 0000000..9699390 Binary files /dev/null and b/Themes/default/images/sp/birthday.png differ diff --git a/Themes/default/images/sp/blog.png b/Themes/default/images/sp/blog.png new file mode 100644 index 0000000..41c536d Binary files /dev/null and b/Themes/default/images/sp/blog.png differ diff --git a/Themes/default/images/sp/board.png b/Themes/default/images/sp/board.png new file mode 100644 index 0000000..67ca8a3 Binary files /dev/null and b/Themes/default/images/sp/board.png differ diff --git a/Themes/default/images/sp/bronze.png b/Themes/default/images/sp/bronze.png new file mode 100644 index 0000000..6f38888 Binary files /dev/null and b/Themes/default/images/sp/bronze.png differ diff --git a/Themes/default/images/sp/collapse.png b/Themes/default/images/sp/collapse.png new file mode 100644 index 0000000..182975e Binary files /dev/null and b/Themes/default/images/sp/collapse.png differ diff --git a/Themes/default/images/sp/deactive.png b/Themes/default/images/sp/deactive.png new file mode 100644 index 0000000..3ab1833 Binary files /dev/null and b/Themes/default/images/sp/deactive.png differ diff --git a/Themes/default/images/sp/delete.png b/Themes/default/images/sp/delete.png new file mode 100644 index 0000000..56ba9e1 Binary files /dev/null and b/Themes/default/images/sp/delete.png differ diff --git a/Themes/default/images/sp/delete_small.png b/Themes/default/images/sp/delete_small.png new file mode 100644 index 0000000..5ab3fec Binary files /dev/null and b/Themes/default/images/sp/delete_small.png differ diff --git a/Themes/default/images/sp/diamond.png b/Themes/default/images/sp/diamond.png new file mode 100644 index 0000000..46be3a7 Binary files /dev/null and b/Themes/default/images/sp/diamond.png differ diff --git a/Themes/default/images/sp/dot.png b/Themes/default/images/sp/dot.png new file mode 100644 index 0000000..3b8e55f Binary files /dev/null and b/Themes/default/images/sp/dot.png differ diff --git a/Themes/default/images/sp/dot1.png b/Themes/default/images/sp/dot1.png new file mode 100644 index 0000000..3b8e55f Binary files /dev/null and b/Themes/default/images/sp/dot1.png differ diff --git a/Themes/default/images/sp/dot2.png b/Themes/default/images/sp/dot2.png new file mode 100644 index 0000000..a2e93de Binary files /dev/null and b/Themes/default/images/sp/dot2.png differ diff --git a/Themes/default/images/sp/dot3.png b/Themes/default/images/sp/dot3.png new file mode 100644 index 0000000..3bc6d88 Binary files /dev/null and b/Themes/default/images/sp/dot3.png differ diff --git a/Themes/default/images/sp/dot4.png b/Themes/default/images/sp/dot4.png new file mode 100644 index 0000000..3ed227f Binary files /dev/null and b/Themes/default/images/sp/dot4.png differ diff --git a/Themes/default/images/sp/dot5.png b/Themes/default/images/sp/dot5.png new file mode 100644 index 0000000..f464695 Binary files /dev/null and b/Themes/default/images/sp/dot5.png differ diff --git a/Themes/default/images/sp/dot6.png b/Themes/default/images/sp/dot6.png new file mode 100644 index 0000000..60fc3a6 Binary files /dev/null and b/Themes/default/images/sp/dot6.png differ diff --git a/Themes/default/images/sp/dot7.png b/Themes/default/images/sp/dot7.png new file mode 100644 index 0000000..13248ec Binary files /dev/null and b/Themes/default/images/sp/dot7.png differ diff --git a/Themes/default/images/sp/dot8.png b/Themes/default/images/sp/dot8.png new file mode 100644 index 0000000..3159f80 Binary files /dev/null and b/Themes/default/images/sp/dot8.png differ diff --git a/Themes/default/images/sp/dot_feed.png b/Themes/default/images/sp/dot_feed.png new file mode 100644 index 0000000..06d2459 Binary files /dev/null and b/Themes/default/images/sp/dot_feed.png differ diff --git a/Themes/default/images/sp/down.png b/Themes/default/images/sp/down.png new file mode 100644 index 0000000..0137435 Binary files /dev/null and b/Themes/default/images/sp/down.png differ diff --git a/Themes/default/images/sp/event.png b/Themes/default/images/sp/event.png new file mode 100644 index 0000000..187cc9c Binary files /dev/null and b/Themes/default/images/sp/event.png differ diff --git a/Themes/default/images/sp/expand.png b/Themes/default/images/sp/expand.png new file mode 100644 index 0000000..87246fe Binary files /dev/null and b/Themes/default/images/sp/expand.png differ diff --git a/Themes/default/images/sp/game.png b/Themes/default/images/sp/game.png new file mode 100644 index 0000000..124325b Binary files /dev/null and b/Themes/default/images/sp/game.png differ diff --git a/Themes/default/images/sp/gmod.png b/Themes/default/images/sp/gmod.png new file mode 100644 index 0000000..59e8828 Binary files /dev/null and b/Themes/default/images/sp/gmod.png differ diff --git a/Themes/default/images/sp/gold.png b/Themes/default/images/sp/gold.png new file mode 100644 index 0000000..80668dc Binary files /dev/null and b/Themes/default/images/sp/gold.png differ diff --git a/Themes/default/images/sp/history.png b/Themes/default/images/sp/history.png new file mode 100644 index 0000000..560071c Binary files /dev/null and b/Themes/default/images/sp/history.png differ diff --git a/Themes/default/images/sp/holiday.png b/Themes/default/images/sp/holiday.png new file mode 100644 index 0000000..7a03a9e Binary files /dev/null and b/Themes/default/images/sp/holiday.png differ diff --git a/Themes/default/images/sp/index.php b/Themes/default/images/sp/index.php new file mode 100644 index 0000000..69278ce --- /dev/null +++ b/Themes/default/images/sp/index.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/Themes/default/images/sp/left.png b/Themes/default/images/sp/left.png new file mode 100644 index 0000000..224ccdd Binary files /dev/null and b/Themes/default/images/sp/left.png differ diff --git a/Themes/default/images/sp/lmod.png b/Themes/default/images/sp/lmod.png new file mode 100644 index 0000000..1428782 Binary files /dev/null and b/Themes/default/images/sp/lmod.png differ diff --git a/Themes/default/images/sp/loading.gif b/Themes/default/images/sp/loading.gif new file mode 100644 index 0000000..1560b64 Binary files /dev/null and b/Themes/default/images/sp/loading.gif differ diff --git a/Themes/default/images/sp/modify.png b/Themes/default/images/sp/modify.png new file mode 100644 index 0000000..f131aad Binary files /dev/null and b/Themes/default/images/sp/modify.png differ diff --git a/Themes/default/images/sp/money.png b/Themes/default/images/sp/money.png new file mode 100644 index 0000000..e376ffd Binary files /dev/null and b/Themes/default/images/sp/money.png differ diff --git a/Themes/default/images/sp/move.png b/Themes/default/images/sp/move.png new file mode 100644 index 0000000..d59360b Binary files /dev/null and b/Themes/default/images/sp/move.png differ diff --git a/Themes/default/images/sp/post.png b/Themes/default/images/sp/post.png new file mode 100644 index 0000000..4a68f7c Binary files /dev/null and b/Themes/default/images/sp/post.png differ diff --git a/Themes/default/images/sp/refresh.png b/Themes/default/images/sp/refresh.png new file mode 100644 index 0000000..0c79f34 Binary files /dev/null and b/Themes/default/images/sp/refresh.png differ diff --git a/Themes/default/images/sp/right.png b/Themes/default/images/sp/right.png new file mode 100644 index 0000000..a7084de Binary files /dev/null and b/Themes/default/images/sp/right.png differ diff --git a/Themes/default/images/sp/silver.png b/Themes/default/images/sp/silver.png new file mode 100644 index 0000000..76fc89b Binary files /dev/null and b/Themes/default/images/sp/silver.png differ diff --git a/Themes/default/images/sp/smiley.png b/Themes/default/images/sp/smiley.png new file mode 100644 index 0000000..3fc7877 Binary files /dev/null and b/Themes/default/images/sp/smiley.png differ diff --git a/Themes/default/images/sp/star.png b/Themes/default/images/sp/star.png new file mode 100644 index 0000000..1393fab Binary files /dev/null and b/Themes/default/images/sp/star.png differ diff --git a/Themes/default/images/sp/star1.png b/Themes/default/images/sp/star1.png new file mode 100644 index 0000000..1393fab Binary files /dev/null and b/Themes/default/images/sp/star1.png differ diff --git a/Themes/default/images/sp/star2.png b/Themes/default/images/sp/star2.png new file mode 100644 index 0000000..8058d60 Binary files /dev/null and b/Themes/default/images/sp/star2.png differ diff --git a/Themes/default/images/sp/star3.png b/Themes/default/images/sp/star3.png new file mode 100644 index 0000000..f91a4f2 Binary files /dev/null and b/Themes/default/images/sp/star3.png differ diff --git a/Themes/default/images/sp/star4.png b/Themes/default/images/sp/star4.png new file mode 100644 index 0000000..49baba1 Binary files /dev/null and b/Themes/default/images/sp/star4.png differ diff --git a/Themes/default/images/sp/star5.png b/Themes/default/images/sp/star5.png new file mode 100644 index 0000000..b2cf366 Binary files /dev/null and b/Themes/default/images/sp/star5.png differ diff --git a/Themes/default/images/sp/star6.png b/Themes/default/images/sp/star6.png new file mode 100644 index 0000000..745cf77 Binary files /dev/null and b/Themes/default/images/sp/star6.png differ diff --git a/Themes/default/images/sp/star7.png b/Themes/default/images/sp/star7.png new file mode 100644 index 0000000..fa8e34b Binary files /dev/null and b/Themes/default/images/sp/star7.png differ diff --git a/Themes/default/images/sp/star8.png b/Themes/default/images/sp/star8.png new file mode 100644 index 0000000..06227ae Binary files /dev/null and b/Themes/default/images/sp/star8.png differ diff --git a/Themes/default/images/sp/stats.png b/Themes/default/images/sp/stats.png new file mode 100644 index 0000000..1db7a2e Binary files /dev/null and b/Themes/default/images/sp/stats.png differ diff --git a/Themes/default/images/sp/stats_member.png b/Themes/default/images/sp/stats_member.png new file mode 100644 index 0000000..1c14638 Binary files /dev/null and b/Themes/default/images/sp/stats_member.png differ diff --git a/Themes/default/images/sp/stats_thank_o_matic.png b/Themes/default/images/sp/stats_thank_o_matic.png new file mode 100644 index 0000000..082afec Binary files /dev/null and b/Themes/default/images/sp/stats_thank_o_matic.png differ diff --git a/Themes/default/images/sp/style.png b/Themes/default/images/sp/style.png new file mode 100644 index 0000000..ce1e792 Binary files /dev/null and b/Themes/default/images/sp/style.png differ diff --git a/Themes/default/images/sp/topic.png b/Themes/default/images/sp/topic.png new file mode 100644 index 0000000..5525566 Binary files /dev/null and b/Themes/default/images/sp/topic.png differ diff --git a/Themes/default/images/sp/tux.png b/Themes/default/images/sp/tux.png new file mode 100644 index 0000000..8ecb13b Binary files /dev/null and b/Themes/default/images/sp/tux.png differ diff --git a/Themes/default/images/sp/up.png b/Themes/default/images/sp/up.png new file mode 100644 index 0000000..c54f4e7 Binary files /dev/null and b/Themes/default/images/sp/up.png differ diff --git a/Themes/default/images/sp/user.png b/Themes/default/images/sp/user.png new file mode 100644 index 0000000..c166ac4 Binary files /dev/null and b/Themes/default/images/sp/user.png differ diff --git a/Themes/default/languages/SPortal.english-utf8.php b/Themes/default/languages/SPortal.english-utf8.php new file mode 100644 index 0000000..712df5b --- /dev/null +++ b/Themes/default/languages/SPortal.english-utf8.php @@ -0,0 +1,127 @@ +Portal.'; +$txt['sp_who_forum'] = 'Viewing the Forum.'; +$txt['sp_who_page'] = 'Viewing the page "%2$s".'; + +// Error messages +$txt['error_sp_no_message_id'] = 'Invalid message ID.'; +$txt['error_sp_article_exists'] = 'This article already exists.'; +$txt['error_sp_cannot_add_article'] = 'You don\'t have permission to add an article.'; +$txt['error_sp_cannot_remove_article'] = 'Sorry, you don\'t have permission to remove an article.'; +$txt['error_sp_name_empty'] = 'The name field was left empty.'; +$txt['error_sp_no_category'] = 'Sorry, articles require categories to be published! Please create a category for articles.'; +$txt['error_sp_no_category_normaluser'] = 'Sorry, articles require categories to be published! Please ask an administrator to create a category for articles.'; +$txt['error_sp_no_category_sp_moderator'] = 'A new category can be created here.'; +$txt['error_sp_side_wrong'] = 'Wrong side selected.'; +$txt['error_sp_block_wrong'] = 'Wrong block selected.'; +$txt['error_sp_php_syntax'] = 'Syntax error in block code. Please check the code.'; +$txt['error_sp_php_database'] = 'Database error in block code. Please check the code.'; +$txt['error_sp_no_posts_found'] = 'No posts were found.'; +$txt['error_sp_no_members_found'] = 'No members were found.'; +$txt['error_sp_no_gallery_found'] = 'There are no gallery mods installed.'; +$txt['error_sp_no_pictures_found'] = 'There are no pictures in the gallery.'; +$txt['error_sp_no_boards_found'] = 'This forum does not have any boards.'; +$txt['error_sp_no_topics_found'] = 'This forum does not have any topics.'; +$txt['error_sp_no_attachments_found'] = 'No attachments were found.'; +$txt['error_sp_no_polls_found'] = 'No polls were found.'; +$txt['error_sp_invalid_feed'] = 'Invalid feed.'; +$txt['error_sp_no_online'] = 'There aren\'t any users online.'; +$txt['error_sp_no_items_day'] = 'No calendar events were found.'; +$txt['error_sp_no_blog_found'] = 'There are no blog mods installed.'; +$txt['error_sp_no_blogs_found'] = 'No blogs were found.'; +$txt['error_sp_no_articles_found'] = 'There are no articles to display.'; +$txt['error_sp_no_shop_found'] = 'There are no shop mods installed.'; +$txt['error_sp_no_arcade_found'] = 'There are no arcade mods installed.'; +$txt['error_sp_no_stats_found'] = 'No statistics found.'; +$txt['error_sp_page_not_found'] = 'The page you requested cannot be found.'; +$txt['error_sp_shoutbox_not_exist'] = 'Sorry, this shoutbox does not exist.'; +$txt['error_sp_no_shoutbox'] = 'There either aren\'t any shoutboxes created yet or there aren\'t any shoutboxes that haven\'t already been published in a shoutbox block.'; +$txt['error_sp_no_shoutbox_sp_moderator'] = 'A new shoutbox can be created here.'; +$txt['error_sp_no_shoutbox_normaluser'] = 'Sorry, shoutbox blocks require a shoutbox to be created before you can display a shoutbox using a shoutbox block ! Please ask an administrator to create a new shoutbox.'; +$txt['error_sp_cannot_shoutbox_moderate'] = 'You don\'t have permission to moderate this shoutbox.'; +$txt['error_sp_no_block'] = 'There aren\'t any blocks created yet.'; +$txt['error_sp_flood_spsbp'] = 'Your last shout was less than %1$d seconds ago. Please try again later.'; + +?> \ No newline at end of file diff --git a/Themes/default/languages/SPortal.english.php b/Themes/default/languages/SPortal.english.php new file mode 100644 index 0000000..712df5b --- /dev/null +++ b/Themes/default/languages/SPortal.english.php @@ -0,0 +1,127 @@ +Portal.'; +$txt['sp_who_forum'] = 'Viewing the Forum.'; +$txt['sp_who_page'] = 'Viewing the page "%2$s".'; + +// Error messages +$txt['error_sp_no_message_id'] = 'Invalid message ID.'; +$txt['error_sp_article_exists'] = 'This article already exists.'; +$txt['error_sp_cannot_add_article'] = 'You don\'t have permission to add an article.'; +$txt['error_sp_cannot_remove_article'] = 'Sorry, you don\'t have permission to remove an article.'; +$txt['error_sp_name_empty'] = 'The name field was left empty.'; +$txt['error_sp_no_category'] = 'Sorry, articles require categories to be published! Please create a category for articles.'; +$txt['error_sp_no_category_normaluser'] = 'Sorry, articles require categories to be published! Please ask an administrator to create a category for articles.'; +$txt['error_sp_no_category_sp_moderator'] = 'A new category can be created here.'; +$txt['error_sp_side_wrong'] = 'Wrong side selected.'; +$txt['error_sp_block_wrong'] = 'Wrong block selected.'; +$txt['error_sp_php_syntax'] = 'Syntax error in block code. Please check the code.'; +$txt['error_sp_php_database'] = 'Database error in block code. Please check the code.'; +$txt['error_sp_no_posts_found'] = 'No posts were found.'; +$txt['error_sp_no_members_found'] = 'No members were found.'; +$txt['error_sp_no_gallery_found'] = 'There are no gallery mods installed.'; +$txt['error_sp_no_pictures_found'] = 'There are no pictures in the gallery.'; +$txt['error_sp_no_boards_found'] = 'This forum does not have any boards.'; +$txt['error_sp_no_topics_found'] = 'This forum does not have any topics.'; +$txt['error_sp_no_attachments_found'] = 'No attachments were found.'; +$txt['error_sp_no_polls_found'] = 'No polls were found.'; +$txt['error_sp_invalid_feed'] = 'Invalid feed.'; +$txt['error_sp_no_online'] = 'There aren\'t any users online.'; +$txt['error_sp_no_items_day'] = 'No calendar events were found.'; +$txt['error_sp_no_blog_found'] = 'There are no blog mods installed.'; +$txt['error_sp_no_blogs_found'] = 'No blogs were found.'; +$txt['error_sp_no_articles_found'] = 'There are no articles to display.'; +$txt['error_sp_no_shop_found'] = 'There are no shop mods installed.'; +$txt['error_sp_no_arcade_found'] = 'There are no arcade mods installed.'; +$txt['error_sp_no_stats_found'] = 'No statistics found.'; +$txt['error_sp_page_not_found'] = 'The page you requested cannot be found.'; +$txt['error_sp_shoutbox_not_exist'] = 'Sorry, this shoutbox does not exist.'; +$txt['error_sp_no_shoutbox'] = 'There either aren\'t any shoutboxes created yet or there aren\'t any shoutboxes that haven\'t already been published in a shoutbox block.'; +$txt['error_sp_no_shoutbox_sp_moderator'] = 'A new shoutbox can be created here.'; +$txt['error_sp_no_shoutbox_normaluser'] = 'Sorry, shoutbox blocks require a shoutbox to be created before you can display a shoutbox using a shoutbox block ! Please ask an administrator to create a new shoutbox.'; +$txt['error_sp_cannot_shoutbox_moderate'] = 'You don\'t have permission to moderate this shoutbox.'; +$txt['error_sp_no_block'] = 'There aren\'t any blocks created yet.'; +$txt['error_sp_flood_spsbp'] = 'Your last shout was less than %1$d seconds ago. Please try again later.'; + +?> \ No newline at end of file diff --git a/Themes/default/languages/SPortalAdmin.english-utf8.php b/Themes/default/languages/SPortalAdmin.english-utf8.php new file mode 100644 index 0000000..7afb2b8 --- /dev/null +++ b/Themes/default/languages/SPortalAdmin.english-utf8.php @@ -0,0 +1,500 @@ +Recommended value: Off'; +$txt['sp_disable_side_collapse'] = 'Disable Side Collapsing'; +$txt['portaltheme'] = 'Portal Theme'; +$txt['portalthemedefault'] = 'Forum Default'; +$txt['sp_resize_images'] = 'Resizes images on portal'; + +// Block settings +$txt['showleft'] = 'Enable Left Side Blocks'; +$txt['showright'] = 'Enable Right Side Blocks'; +$txt['leftwidth'] = 'Width of Left Side Blocks'; +$txt['rightwidth'] = 'Width of Right Side Blocks'; +$txt['sp_enableIntegration'] = 'Display Blocks in Forum'; +$txt['sp_IntegrationHide'] = 'Hide Blocks in Forum Areas
The Display blocks in Forum setting
must be enabled for this to work
'; + +// Article settings +$txt['articleactive'] = 'Enable Articles'; +$txt['articleperpage'] = 'Maximum Articles Per Page'; +$txt['articlelength'] = 'Maximum Characters Before Article Cut-off'; +$txt['articleavatar'] = 'Display Authors Avatar'; + +// Blocks area +$txt['sp-adminBlockListName'] = 'Block List'; +$txt['sp-adminBlockListDesc'] = 'This page displays a list of all blocks which have been created for the portal or the forum.'; +$txt['sp-adminBlockAddName'] = 'Add Block'; +$txt['sp-adminBlockAddDesc'] = 'This page enables new blocks to be created and added to the portal page or the forum.'; +$txt['sp-adminBlockLeftListDesc'] = 'This page displays a list of all left side blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockRightListDesc'] = 'This page displays a list of all right side blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockTopListDesc'] = 'This page displays a list of all top area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockBottomListDesc'] = 'This page displays a list of all bottom area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockHeaderListDesc'] = 'This page displays a list of all header area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockFooterListDesc'] = 'This page displays a list of all footer area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; + +// Block list +$txt['sp-blocksBlocks'] = 'Blocks'; +$txt['sp-blocksActive'] = 'Active'; +$txt['sp-blocksActivate'] = 'Activate'; +$txt['sp-blocksDeactivate'] = 'Deactivate'; +$txt['sp-blocksCreate'] = 'Create %s Block'; +$txt['sp-deleteblock'] = 'Are you sure you want to delete this block?'; +$txt['sp-blocks_select_destination'] = 'Select destination for block \'%1$s\''; +$txt['sp-blocks_move_here'] = 'Move block here'; +$txt['sp-blocks_cancel_moving'] = 'Cancel moving'; + +// Add/Edit blocks +$txt['sp-blocksSelectType'] = 'Select Block Type'; +$txt['sp-blocksAdd'] = 'Add Block'; +$txt['sp-blocksEdit'] = 'Edit Block'; +$txt['sp-blocksPreview'] = 'Preview'; +$txt['sp-blocksDefaultLabel'] = 'Untitled'; +$txt['sp-blocksDisabledBoth'] = 'Left and right side blocks are currently disabled'; +$txt['sp-blocksDisabledLeft'] = 'Left side blocks are currently disabled'; +$txt['sp-blocksDisabledRight'] = 'Right side blocks are currently disabled'; +$txt['sp-blocksContent'] = 'Content'; +$txt['sp-blocksColumn'] = 'Column'; +$txt['sp_admin_blocks_col_permissions'] = 'Permissions'; +$txt['sp_admin_blocks_permissions_set_custom'] = 'Custom'; +$txt['sp_admin_blocks_permissions_set_guests'] = 'Guests'; +$txt['sp_admin_blocks_permissions_set_members'] = 'Members'; +$txt['sp_admin_blocks_permissions_set_everyone'] = 'Everyone'; +$txt['sp_admin_blocks_col_custom_permissions'] = 'Custom Permissions'; +$txt['sp_admin_blocks_custom_permissions_membergroup'] = 'Membergroup'; +$txt['sp_admin_blocks_custom_permissions_allowed_short'] = 'A'; +$txt['sp_admin_blocks_custom_permissions_disallowed_short'] = 'X'; +$txt['sp_admin_blocks_custom_permissions_denied_short'] = 'D'; +$txt['sp_admin_blocks_custom_permissions_allowed'] = 'Allowed'; +$txt['sp_admin_blocks_custom_permissions_disallowed'] = 'Disallowed'; +$txt['sp_admin_blocks_custom_permissions_denied'] = 'Denied'; +$txt['sp-blocksRow'] = 'Order'; +$txt['sp-blocksForce'] = 'Not Collapsible'; +$txt['sp-blocksDisplayOptions'] = 'Display Options'; +$txt['sp-blocksAdvancedOptions'] = 'Advanced Options'; +$txt['sp-blocksShowBlock'] = 'Show Block On'; +$txt['sp-blocksOptionAllPages'] = 'All Pages'; +$txt['sp-blocksOptionAllActions'] = 'All Actions'; +$txt['sp-blocksOptionAllBoards'] = 'All Boards'; +$txt['sp-blocksOptionEverywhere'] = 'Everywhere'; +$txt['sp-blocksSelectActions'] = 'Select Actions'; +$txt['sp-blocksSelectBoards'] = 'Select Boards'; +$txt['sp-blocksSelectPages'] = 'Select Pages'; +$txt['sp_display_custom'] = 'Custom Display Options'; +$txt['sp-blocksStyleOptions'] = 'Style Options'; +$txt['sp-blocksTitleDefaultClass'] = 'Default Title Class'; +$txt['sp-blocksTitleCustomClass'] = 'Custom Title Class'; +$txt['sp-blocksTitleCustomStyle'] = 'Custom Title Style'; +$txt['sp-blocksBodyDefaultClass'] = 'Default Body Class'; +$txt['sp-blocksBodyCustomClass'] = 'Custom Body Class'; +$txt['sp-blocksBodyCustomStyle'] = 'Custom Body Style'; +$txt['sp-blocksNoTitle'] = 'No Title'; +$txt['sp-blocksNoBody'] = 'No Body'; + +// Block labels +$txt['sp_function_sp_userInfo_label'] = 'Member Information'; +$txt['sp_function_sp_latestMember_label'] = 'Latest Members'; +$txt['sp_function_sp_whosOnline_label'] = 'Who\'s Online'; +$txt['sp_function_sp_showPoll_label'] = 'Poll'; +$txt['sp_function_sp_boardStats_label'] = 'Board Statistics'; +$txt['sp_function_sp_quickSearch_label'] = 'Quick Search'; +$txt['sp_function_sp_topPoster_label'] = 'Top Poster'; +$txt['sp_function_sp_topStatsMember_label'] = 'Top Member Stats'; +$txt['sp_function_sp_topBoards_label'] = 'Top Boards'; +$txt['sp_function_sp_topTopics_label'] = 'Top Topics'; +$txt['sp_function_sp_recent_label'] = 'Recent Posts/Topics'; +$txt['sp_function_sp_boardNews_label'] = 'Board News'; +$txt['sp_function_sp_news_label'] = 'Forum News'; +$txt['sp_function_sp_attachmentImage_label'] = 'Recent Image Attachments'; +$txt['sp_function_sp_attachmentRecent_label'] = 'Recent Attachments'; +$txt['sp_function_sp_calendar_label'] = 'Calendar'; +$txt['sp_function_sp_calendarInformation_label'] = 'Calendar Information'; +$txt['sp_function_sp_rssFeed_label'] = 'RSS Feed'; +$txt['sp_function_sp_theme_select_label'] = 'Theme Selection'; +$txt['sp_function_sp_staff_label'] = 'Staff List'; +$txt['sp_function_sp_articles_label'] = 'Articles'; +$txt['sp_function_sp_shoutbox_label'] = 'Shoutbox'; +$txt['sp_function_sp_gallery_label'] = 'Gallery'; +$txt['sp_function_sp_arcade_label'] = 'Arcade'; +$txt['sp_function_sp_shop_label'] = 'Shop'; +$txt['sp_function_sp_blog_label'] = 'Blog'; +$txt['sp_function_sp_menu_label'] = 'Forum Menu'; +$txt['sp_function_sp_bbc_label'] = 'Custom BBC'; +$txt['sp_function_sp_html_label'] = 'Custom HTML'; +$txt['sp_function_sp_php_label'] = 'Custom PHP'; + +// Block descriptions +$txt['sp_function_sp_latestMember_desc'] = 'Displays the latest members and their registration dates.'; +$txt['sp_function_sp_userInfo_desc'] = 'Displays member information if the viewer is logged in, and a login box if the viewer is a guest.'; +$txt['sp_function_sp_whosOnline_desc'] = 'Displays the who\'s online list.'; +$txt['sp_function_sp_showPoll_desc'] = 'Displays a poll with voting options if the viewer can vote, or the results if the viewer is unable to vote.'; +$txt['sp_function_sp_boardStats_desc'] = 'Displays some statistical information about the forum.'; +$txt['sp_function_sp_quickSearch_desc'] = 'Displays a simple quick search form.'; +$txt['sp_function_sp_topPoster_desc'] = 'Displays the top posters with their post count and avatars.'; +$txt['sp_function_sp_topStatsMember_desc'] = 'Displays various types of member stats.'; +$txt['sp_function_sp_topBoards_desc'] = 'Displays a list of boards according to their activity.'; +$txt['sp_function_sp_topTopics_desc'] = 'Displays a list topics according to their activity.'; +$txt['sp_function_sp_recent_desc'] = 'Displays a list of the forums recent posts or topics.'; +$txt['sp_function_sp_boardNews_desc'] = 'Displays a list of posts from a selected board.'; +$txt['sp_function_sp_news_desc'] = 'Displays a random news line.'; +$txt['sp_function_sp_attachmentImage_desc'] = 'Displays a list of recently attached images.'; +$txt['sp_function_sp_attachmentRecent_desc'] = 'Displays a list of recent attachments.'; +$txt['sp_function_sp_calendar_desc'] = 'Displays a full month calendar with all events.'; +$txt['sp_function_sp_calendarInformation_desc'] = 'Displays calendar information such as birthdays, events and holidays.'; +$txt['sp_function_sp_rssFeed_desc'] = 'Displays an RSS Feed.'; +$txt['sp_function_sp_theme_select_desc'] = 'Displays a list of available themes and allows members to select one.'; +$txt['sp_function_sp_staff_desc'] = 'Displays list of forum staff with their position and avatar.'; +$txt['sp_function_sp_articles_desc'] = 'Displays recent or random articles.'; +$txt['sp_function_sp_shoutbox_desc'] = 'Displays a shoutbox.'; +$txt['sp_function_sp_gallery_desc'] = 'Displays a list of recent gallery items.'; +$txt['sp_function_sp_arcade_desc'] = 'Displays various statistics from the arcade if an arcade mod is installed.'; +$txt['sp_function_sp_shop_desc'] = 'Displays the richest members or various items from the shop if a shop mod is installed.'; +$txt['sp_function_sp_blog_desc'] = 'Displays various information from the forum blog.'; +$txt['sp_function_sp_menu_desc'] = 'Displays a vertical forum menu.'; +$txt['sp_function_sp_bbc_desc'] = 'A custom block where BBC content can be added.'; +$txt['sp_function_sp_html_desc'] = 'A custom block where HTML content can be added.'; +$txt['sp_function_sp_php_desc'] = 'A custom block where PHP content can be added.'; + +// Block parameters +$txt['sp_param_sp_latestMember_limit'] = 'Members to Show'; +$txt['sp_param_sp_whosOnline_online_today'] = 'Users Online Today'; +$txt['sp_param_sp_boardStats_averages'] = 'Show Averages'; +$txt['sp_param_sp_topPoster_limit'] = 'Top Posters to Display'; +$txt['sp_param_sp_topPoster_type'] = 'Display'; +$txt['sp_param_sp_topStatsMember_type'] = 'Type of the Top Member List'; +$txt['sp_param_sp_topStatsMember_limit'] = 'Members to display'; +$txt['sp_param_sp_topStatsMember_enable_label'] = 'Enable label for list'; +$txt['sp_param_sp_topStatsMember_list_label'] = 'List label'; +$txt['sp_param_sp_topStatsMember_sort_asc'] = 'Sort in reverse order'; +$txt['sp_param_sp_topStatsMember_last_active_limit'] = 'Remove inactive Members from the List
(Time in days)'; +$txt['sp_param_sp_recent_limit'] = 'Recent Posts or Topics to Display'; +$txt['sp_param_sp_recent_type'] = 'Display'; +$txt['sp_param_sp_recent_display'] = 'Display type'; +$txt['sp_param_sp_recent_boards'] = 'Include boards'; +$txt['sp_param_sp_topTopics_type'] = 'Sorting Type'; +$txt['sp_param_sp_topTopics_limit'] = 'Topics to Display'; +$txt['sp_param_sp_topBoards_limit'] = 'Boards to Display'; +$txt['sp_param_sp_showPoll_topic'] = 'Topic ID'; +$txt['sp_param_sp_showPoll_type'] = 'Type'; +$txt['sp_param_sp_boardNews_board'] = 'Boards'; +$txt['sp_param_sp_boardNews_limit'] = 'Topics to Display'; +$txt['sp_param_sp_boardNews_start'] = 'Starting Post ID'; +$txt['sp_param_sp_boardNews_length'] = 'Maximum Characters'; +$txt['sp_param_sp_boardNews_avatar'] = 'Display Avatars'; +$txt['sp_param_sp_boardNews_per_page'] = 'Posts Per Page'; +$txt['sp_param_sp_attachmentImage_limit'] = 'Images to Display'; +$txt['sp_param_sp_attachmentImage_direction'] = 'List Direction'; +$txt['sp_param_sp_attachmentImage_disablePoster'] = 'Remove Image Poster\'s Name'; +$txt['sp_param_sp_attachmentImage_disableDownloads'] = 'Remove image Download'; +$txt['sp_param_sp_attachmentImage_disableLink'] = 'Remove Image Download Link'; +$txt['sp_param_sp_attachmentRecent_limit'] = 'Attachments to Display'; +$txt['sp_param_sp_calendar_events'] = 'Show Events'; +$txt['sp_param_sp_calendar_birthdays'] = 'Show Birthdays'; +$txt['sp_param_sp_calendar_holidays'] = 'Show Holidays'; +$txt['sp_param_sp_calendarInformation_events'] = 'Show Events'; +$txt['sp_param_sp_calendarInformation_future'] = 'Number of days in future to show events'; +$txt['sp_param_sp_calendarInformation_birthdays'] = 'Show Birthdays'; +$txt['sp_param_sp_calendarInformation_holidays'] = 'Show Holidays'; +$txt['sp_param_sp_rssFeed_url'] = 'Feed URL'; +$txt['sp_param_sp_rssFeed_show_title'] = 'Show Title'; +$txt['sp_param_sp_rssFeed_show_content'] = 'Show Content'; +$txt['sp_param_sp_rssFeed_show_date'] = 'Show Date'; +$txt['sp_param_sp_rssFeed_strip_preserve'] = 'Tags to Preserve'; +$txt['sp_param_sp_rssFeed_count'] = 'Items to Show'; +$txt['sp_param_sp_rssFeed_limit'] = 'Character Limit'; +$txt['sp_param_sp_staff_lmod'] = 'Disable Local Moderators'; +$txt['sp_param_sp_articles_category'] = 'Category'; +$txt['sp_param_sp_articles_limit'] = 'Articles to Display'; +$txt['sp_param_sp_articles_type'] = 'Display Type'; +$txt['sp_param_sp_articles_image'] = 'Image'; +$txt['sp_param_sp_shoutbox_shoutbox'] = 'Shoutbox to Display'; +$txt['sp_param_sp_gallery_limit'] = 'Items to Display'; +$txt['sp_param_sp_gallery_type'] = 'Display'; +$txt['sp_param_sp_gallery_direction'] = 'List Direction'; +$txt['sp_param_sp_arcade_limit'] = 'Items to display'; +$txt['sp_param_sp_arcade_type'] = 'Display'; +$txt['sp_param_sp_shop_style'] = 'Display'; +$txt['sp_param_sp_shop_limit'] = 'Items to display'; +$txt['sp_param_sp_shop_type'] = 'Money type'; +$txt['sp_param_sp_shop_sort'] = 'Item type'; +$txt['sp_param_sp_blog_limit'] = 'Items to Display'; +$txt['sp_param_sp_blog_type'] = 'Item Type'; +$txt['sp_param_sp_blog_sort'] = 'Display'; +$txt['sp_param_sp_html_content'] = 'Custom HTML'; +$txt['sp_param_sp_bbc_content'] = 'Custom BBC'; +$txt['sp_param_sp_php_content'] = 'Custom PHP'; + +// Parameter options +$txt['sp_param_sp_topPoster_type_options'] = 'All Time|Today|This Week|This Month'; +$txt['sp_param_sp_topStatsMember_type_options'] = 'Total Time Logged In|Posts|Good Karma|Bad Karma|Total Karma|Thank-O-Matic Top Given|Thank-O-Matic Top Received|Automatic Karma Good|Automatic Karma Bad|Automatic Karma Total|Advanced Reputation System Best|Advanced Reputation System Worst'; +$txt['sp_param_sp_recent_type_options'] = 'Posts|Topics'; +$txt['sp_param_sp_recent_display_options'] = 'Compact|Full'; +$txt['sp_param_sp_topTopics_type_options'] = 'Replies|Views'; +$txt['sp_param_sp_showPoll_type_options'] = 'Normal|Recent|Random'; +$txt['sp_param_sp_attachmentImage_direction_options'] = 'Vertical|Horizontal'; +$txt['sp_param_sp_articles_type_options'] = 'Latest|Random'; +$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image'; +$txt['sp_param_sp_gallery_type_options'] = 'Latest|Random'; +$txt['sp_param_sp_gallery_direction_options'] = 'Vertical|Horizontal'; +$txt['sp_param_sp_arcade_type_options'] = 'Most Played|Best Players|Longest Champ'; +$txt['sp_param_sp_shop_style_options'] = 'Members|Items'; +$txt['sp_param_sp_shop_type_options'] = 'Total|Pocket|Bank'; +$txt['sp_param_sp_shop_sort_options'] = 'Recent|Random'; +$txt['sp_param_sp_blog_type_options'] = 'Articles|Blogs'; +$txt['sp_param_sp_blog_sort_options'] = 'Latest|Random'; + +// Articles area +$txt['sp-adminArticleListName'] = 'Article List'; +$txt['sp-adminArticleListDesc'] = 'This page displays a list of all topics that have been added as articles. These can be modified by selecting the appropriate options.'; +$txt['sp-adminArticleAddName'] = 'Add Article'; +$txt['sp-adminArticleAddDesc'] = 'This page enables articles to be added to the portal page.'; +$txt['sp-adminArticleAddNoTopics'] = 'This board has no remaining topics that can be added as articles.'; + +// Article list +$txt['sp-articlesRemove'] = 'Remove Selected'; +$txt['sp-articlesConfirm'] = 'Are you sure you want to delete these articles?'; +$txt['sp-articlesDeleteConfirm'] = 'Are you sure you want to delete this article?'; + +// Add/Edit articles +$txt['sp-articlesAdd'] = 'Add Article'; +$txt['sp-articlesEdit'] = 'Edit Article'; +$txt['sp-articlesCategory'] = 'Article Category'; +$txt['sp-articlesApproved'] = 'Approved'; + +// Categories area +$txt['sp-adminCategoryListName'] = 'Category List'; +$txt['sp-adminCategoryListDesc'] = 'This page displays a list of article categories that have been created. These can be modified by selecting the appropriate options.'; +$txt['sp-adminCategoryAddName'] = 'Add Category'; +$txt['sp-adminCategoryAddDesc'] = 'This page enables new categories to be added for articles to be placed in.'; + +// Category list +$txt['sp-categoriesCategories'] = 'Categories'; + +// Add/Edit category +$txt['sp-categoriesAdd'] = 'Add Category'; +$txt['sp-categoriesEdit'] = 'Edit Category'; +$txt['sp-categoriesName'] = 'Name'; +$txt['sp-categoriesPicture'] = 'Image URL'; +$txt['sp-categoriesPublish'] = 'Publish on Portal'; + +// Delete category +$txt['sp-categoriesDelete'] = 'Delete Category'; +$txt['sp-categoriesDeleteCount'] = 'There are %s article(s) in this category.'; +$txt['sp-categoriesDeleteOption1'] = 'Do you want to move these articles to another category?'; +$txt['sp-categoriesDeleteOption2'] = 'By deleting this category your articles will also be deleted.'; +$txt['sp-categoriesDeleteConfirm'] = 'Are you sure you wish to delete this category?'; +$txt['sp-categoriesMove'] = 'Move'; +$txt['sp-categoriesMoveTo'] = 'Move To'; + +// Block list titles +$txt['sp-adminColumnType'] = 'Type'; +$txt['sp-adminColumnMove'] = 'Move'; + +// Article list titles +$txt['sp-adminColumnTopic'] = 'Topic'; +$txt['sp-adminColumnBoard'] = 'Board'; +$txt['sp-adminColumnPoster'] = 'Poster'; +$txt['sp-adminColumnTime'] = 'Time'; +$txt['sp-adminColumnCategory'] = 'Category'; +$txt['sp-adminColumnApproved'] = 'Approved'; + +// Category list titles +$txt['sp-adminColumnPicture'] = 'Picture'; +$txt['sp-adminColumnArticles'] = 'Articles'; +$txt['sp-adminColumnPublish'] = 'Publish'; + +// Pages Area +$txt['sp_admin_pages_title'] = 'Pages'; +$txt['sp_admin_pages_list'] = 'Page List'; +$txt['sp_admin_pages_add'] = 'Add Page'; +$txt['sp_admin_pages_edit'] = 'Edit Page'; +$txt['sp_admin_pages_remove'] = 'Remove Pages'; +$txt['sp_admin_pages_preview'] = 'Preview'; +$txt['sp_admin_pages_general'] = 'General Settings'; +$txt['sp_admin_pages_style'] = 'Style Options'; + +$txt['sp_admin_pages_desc'] = 'You can create and manage SimplePortal pages in this area.'; +$txt['sp_pages_remove_confirm'] = 'Are you sure that you want to remove the selected pages?'; +$txt['sp_admin_pages_delete_confirm'] = 'Are you sure you want to delete this page?'; +$txt['sp_error_no_pages'] = 'There are no pages available.'; +$txt['sp_error_page_name_empty'] = 'Sorry, you left the page name empty.'; +$txt['sp_error_page_namespace_empty'] = 'Sorry, you left the page ID empty.'; +$txt['sp_error_page_namespace_duplicate'] = 'Sorry, that page ID is already in use.'; +$txt['sp_error_page_namespace_invalid_chars'] = 'Sorry, there are invalid characters in the page ID. Page ID\'s can only contain letters, numbers and underscores.'; +$txt['sp_error_page_namespace_numeric'] = 'Sorry, page ID\'s cannot be only numbers. Page ID\'s need letters, and or an underscore'; + +$txt['sp_admin_pages_col_title'] = 'Title'; +$txt['sp_admin_pages_col_namespace'] = 'Page ID'; +$txt['sp_admin_pages_col_body'] = 'Body'; +$txt['sp_admin_pages_col_type'] = 'Type'; +$txt['sp_admin_pages_col_views'] = 'Views'; +$txt['sp_admin_pages_col_status'] = 'Active'; +$txt['sp_admin_pages_col_actions'] = 'Actions'; +$txt['sp_admin_pages_col_permissions'] = 'Permissions'; +$txt['sp_admin_pages_permissions_set_custom'] = 'Custom'; +$txt['sp_admin_pages_permissions_set_guests'] = 'Guests'; +$txt['sp_admin_pages_permissions_set_members'] = 'Members'; +$txt['sp_admin_pages_permissions_set_everyone'] = 'Everyone'; +$txt['sp_admin_pages_col_custom_permissions'] = 'Custom Permissions'; +$txt['sp_admin_pages_custom_permissions_membergroup'] = 'Membergroup'; +$txt['sp_admin_pages_custom_permissions_allowed_short'] = 'A'; +$txt['sp_admin_pages_custom_permissions_disallowed_short'] = 'X'; +$txt['sp_admin_pages_custom_permissions_denied_short'] = 'D'; +$txt['sp_admin_pages_custom_permissions_allowed'] = 'Allowed'; +$txt['sp_admin_pages_custom_permissions_disallowed'] = 'Disallowed'; +$txt['sp_admin_pages_custom_permissions_denied'] = 'Denied'; +$txt['sp_admin_pages_col_blocks'] = 'Blocks'; +$txt['sp_admin_pages_activate'] = 'Activate'; +$txt['sp_admin_pages_deactivate'] = 'Deactivate'; + +$txt['sp_pages_default_title'] = 'Untitled Page'; + +$txt['sp_pages_type_bbc'] = 'BBC'; +$txt['sp_pages_type_html'] = 'HTML'; +$txt['sp_pages_type_php'] = 'PHP'; + +// Shoutboxes Area +$txt['sp_admin_shoutbox_title'] = 'Shoutbox'; +$txt['sp_admin_shoutbox_list'] = 'Shoutbox List'; +$txt['sp_admin_shoutbox_add'] = 'Add Shoutbox'; +$txt['sp_admin_shoutbox_edit'] = 'Edit Shoutbox'; +$txt['sp_admin_shoutbox_prune'] = 'Prune Shoutbox'; +$txt['sp_admin_shoutbox_remove'] = 'Remove Shoutboxes'; + +$txt['sp_admin_shoutbox_desc'] = 'You can create and manage SimplePortal shoutboxes in this area.'; +$txt['sp_shoutbox_remove_confirm'] = 'Are you sure that you want to remove the selected shoutboxes?'; +$txt['sp_admin_shoutbox_delete_confirm'] = 'Are you sure you want to delete this shoutbox?'; +$txt['sp_error_no_shoutbox'] = 'There are no shoutboxes available.'; +$txt['sp_error_shoutbox_name_duplicate'] = 'Sorry, there is already a shoutbox with that name.'; + +$txt['sp_admin_shoutbox_col_name'] = 'Name'; +$txt['sp_admin_shoutbox_col_shouts'] = 'Shouts'; +$txt['sp_admin_shoutbox_col_caching'] = 'Caching'; +$txt['sp_admin_shoutbox_col_status'] = 'Status'; +$txt['sp_admin_shoutbox_col_actions'] = 'Actions'; +$txt['sp_admin_shoutbox_col_permissions'] = 'Permissions'; +$txt['sp_admin_shoutbox_permissions_set_custom'] = 'Custom'; +$txt['sp_admin_shoutbox_permissions_set_guests'] = 'Guests'; +$txt['sp_admin_shoutbox_permissions_set_members'] = 'Members'; +$txt['sp_admin_shoutbox_permissions_set_everyone'] = 'Everyone'; +$txt['sp_admin_shoutbox_col_custom_permissions'] = 'Custom Permissions'; +$txt['sp_admin_shoutbox_custom_permissions_membergroup'] = 'Membergroup'; +$txt['sp_admin_shoutbox_custom_permissions_allowed_short'] = 'A'; +$txt['sp_admin_shoutbox_custom_permissions_disallowed_short'] = 'X'; +$txt['sp_admin_shoutbox_custom_permissions_denied_short'] = 'D'; +$txt['sp_admin_shoutbox_custom_permissions_allowed'] = 'Allowed'; +$txt['sp_admin_shoutbox_custom_permissions_disallowed'] = 'Disallowed'; +$txt['sp_admin_shoutbox_custom_permissions_denied'] = 'Denied'; +$txt['sp_admin_shoutbox_col_moderators'] = 'Moderators'; +$txt['sp_admin_shoutbox_col_reverse'] = 'Reverse Order'; +$txt['sp_admin_shoutbox_activate'] = 'Activate'; +$txt['sp_admin_shoutbox_deactivate'] = 'Deactivate'; + +$txt['sp_shoutbox_default_name'] = 'Untitled Shoutbox'; + +$txt['sp_admin_shoutbox_col_warning'] = 'Warning'; +$txt['sp_admin_shoutbox_col_bbc'] = 'Allowed BBC'; +$txt['sp_admin_shoutbox_col_height'] = 'Height(pixels)'; +$txt['sp_admin_shoutbox_col_num_show'] = 'Shouts to display'; +$txt['sp_admin_shoutbox_col_num_max'] = 'Maximum shouts'; +$txt['sp_admin_shoutbox_col_refresh'] = 'Auto refresh(seconds)'; + +$txt['sp_admin_shoutbox_opt_all'] = 'Delete all shouts'; +$txt['sp_admin_shoutbox_opt_days'] = 'Delete shouts older than a number of days'; +$txt['sp_admin_shoutbox_opt_member'] = 'Delete shouts posted by a member'; + +$txt['sp_admin_shoutbox_block_redirect_message'] = '

Congratulations, you have created a new shoutbox!

+

Although it won\'t be displayed anywhere within your forum yet. You will need to create a shoutbox block before your users can use the shoutbox.

+

Click here to create a new shoutbox block for this shoutbox.

+

Click here to continue to your list of shoutboxes.

'; + +// General titles +$txt['sp-adminColumnAction'] = 'Action'; +$txt['sp-adminColumnName'] = 'Name'; + +// Miscellaneous strings +$txt['sp-positionLeft'] = 'Left'; +$txt['sp-positionTop'] = 'Top'; +$txt['sp-positionBottom'] = 'Bottom'; +$txt['sp-positionRight'] = 'Right'; +$txt['sp-positionHeader'] = 'Header'; +$txt['sp-positionFooter'] = 'Footer'; +$txt['sp-placementBefore'] = 'Before'; +$txt['sp-placementAfter'] = 'After'; +$txt['sp-placementUnchanged'] = 'Unchanged'; +$txt['sp-stateYes'] = 'Yes'; +$txt['sp-stateNo'] = 'No'; + +// Information area +$txt['sp-info_title'] = 'Information'; +$txt['sp-info_desc'] = 'Some useful system, and SimplePortal information.'; +$txt['sp-info_live'] = 'Live from SimplePortal...'; +$txt['sp-info_no_live'] = 'Sorry! At this time you are unable to connect to simpleportal.net\'s latest news file.'; +$txt['sp-info_general'] = 'General Information'; +$txt['sp-info_versions'] = 'Version Information'; +$txt['sp-info_your_version'] = 'Your Version'; +$txt['sp-info_current_version'] = 'Current Version'; +$txt['sp-info_managers'] = 'Managers'; +$txt['sp-info_intro'] = 'The SimplePortal Team wants to thank everyone who helped make SimplePortal what it is today, and the Simple Machines Team for the great forum software, SMF. It wouldn\'t have been possible without you, our users, and SMF.'; +$txt['sp-info_team'] = 'The Team'; +$txt['sp-info_special'] = 'Special Thanks'; +$txt['sp-info_and'] = 'and'; +$txt['sp-info_anyone'] = 'For anyone we may have missed, thank you!'; +$txt['sp-info_groups_pm'] = 'Project Managers'; +$txt['sp-info_groups_dev'] = 'Developers'; +$txt['sp-info_groups_support'] = 'Support Specialists'; +$txt['sp-info_groups_customize'] = 'Customizers'; +$txt['sp-info_groups_language'] = 'Language Managers'; +$txt['sp-info_groups_marketing'] = 'Marketing'; +$txt['sp-info_groups_beta'] = 'Beta Testers'; +$txt['sp-info_groups_translators'] = 'Language Translators'; +$txt['sp-info_translators_message'] = 'Thank you for your efforts in the internationalization of SimplePortal.'; +$txt['sp-info_groups_founder'] = 'Founding Father of SimplePortal'; +$txt['sp-info_groups_orignal_pm'] = 'Original Project Managers'; +$txt['sp-info_fam_fam'] = 'Pretty Icons'; +$txt['sp-info_fam_fam_message'] = 'Mark James for his Fam Fam Fam Silk Icons.'; +$txt['sp-info_contribute'] = 'Did you find SimplePortal useful? Contribute to the project!'; + +// Permissions +$txt['permissiongroup_sp'] = 'SimplePortal'; +$txt['permissiongroup_simple_sp'] = 'SimplePortal'; +$txt['permissionname_sp_admin'] = 'Administrate portal'; +$txt['permissionhelp_sp_admin'] = 'This permission allows users to administrate SimplePortal.'; +$txt['permissionname_sp_manage_settings'] = 'Manage portal settings'; +$txt['permissionhelp_sp_manage_settings'] = 'This permission allows users to manage SimplePortal settings.'; +$txt['permissionname_sp_manage_blocks'] = 'Manage portal blocks'; +$txt['permissionhelp_sp_manage_blocks'] = 'This permission allows users to manage SimplePortal blocks.'; +$txt['permissionname_sp_manage_articles'] = 'Manage portal articles'; +$txt['permissionhelp_sp_manage_articles'] = 'This permission allows users to manage SimplePortal articles.'; +$txt['permissionname_sp_manage_pages'] = 'Manage portal pages'; +$txt['permissionhelp_sp_manage_pages'] = 'This permission allows users to manage SimplePortal pages.'; +$txt['permissionname_sp_manage_shoutbox'] = 'Manage portal shoutboxes'; +$txt['permissionhelp_sp_manage_shoutbox'] = 'This permission allows users to manage SimplePortal shoutboxes.'; +$txt['permissionname_sp_add_article'] = 'Can add article'; +$txt['permissionhelp_sp_add_article'] = 'This permission allows users to add articles.'; +$txt['permissionname_sp_auto_article_approval'] = 'Automatic article approval'; +$txt['permissionhelp_sp_auto_article_approval'] = 'This permission allows users to add articles without requiring approval.'; +$txt['permissionname_sp_remove_article'] = 'Can remove article'; +$txt['permissionhelp_sp_remove_article'] = 'This permission allows users to remove articles.'; + +// Compatibility strings +$txt['sp-adminCatHelp'] = 'Here you can manage and configure SimplePortal.'; +$txt['sp-adminCatDesc'] = 'Here you can manage and configure SimplePortal.'; + +?> \ No newline at end of file diff --git a/Themes/default/languages/SPortalAdmin.english.php b/Themes/default/languages/SPortalAdmin.english.php new file mode 100644 index 0000000..7afb2b8 --- /dev/null +++ b/Themes/default/languages/SPortalAdmin.english.php @@ -0,0 +1,500 @@ +Recommended value: Off'; +$txt['sp_disable_side_collapse'] = 'Disable Side Collapsing'; +$txt['portaltheme'] = 'Portal Theme'; +$txt['portalthemedefault'] = 'Forum Default'; +$txt['sp_resize_images'] = 'Resizes images on portal'; + +// Block settings +$txt['showleft'] = 'Enable Left Side Blocks'; +$txt['showright'] = 'Enable Right Side Blocks'; +$txt['leftwidth'] = 'Width of Left Side Blocks'; +$txt['rightwidth'] = 'Width of Right Side Blocks'; +$txt['sp_enableIntegration'] = 'Display Blocks in Forum'; +$txt['sp_IntegrationHide'] = 'Hide Blocks in Forum Areas
The Display blocks in Forum setting
must be enabled for this to work
'; + +// Article settings +$txt['articleactive'] = 'Enable Articles'; +$txt['articleperpage'] = 'Maximum Articles Per Page'; +$txt['articlelength'] = 'Maximum Characters Before Article Cut-off'; +$txt['articleavatar'] = 'Display Authors Avatar'; + +// Blocks area +$txt['sp-adminBlockListName'] = 'Block List'; +$txt['sp-adminBlockListDesc'] = 'This page displays a list of all blocks which have been created for the portal or the forum.'; +$txt['sp-adminBlockAddName'] = 'Add Block'; +$txt['sp-adminBlockAddDesc'] = 'This page enables new blocks to be created and added to the portal page or the forum.'; +$txt['sp-adminBlockLeftListDesc'] = 'This page displays a list of all left side blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockRightListDesc'] = 'This page displays a list of all right side blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockTopListDesc'] = 'This page displays a list of all top area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockBottomListDesc'] = 'This page displays a list of all bottom area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockHeaderListDesc'] = 'This page displays a list of all header area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; +$txt['sp-adminBlockFooterListDesc'] = 'This page displays a list of all footer area blocks which have been created. These blocks can be modified by selecting the appropriate options.'; + +// Block list +$txt['sp-blocksBlocks'] = 'Blocks'; +$txt['sp-blocksActive'] = 'Active'; +$txt['sp-blocksActivate'] = 'Activate'; +$txt['sp-blocksDeactivate'] = 'Deactivate'; +$txt['sp-blocksCreate'] = 'Create %s Block'; +$txt['sp-deleteblock'] = 'Are you sure you want to delete this block?'; +$txt['sp-blocks_select_destination'] = 'Select destination for block \'%1$s\''; +$txt['sp-blocks_move_here'] = 'Move block here'; +$txt['sp-blocks_cancel_moving'] = 'Cancel moving'; + +// Add/Edit blocks +$txt['sp-blocksSelectType'] = 'Select Block Type'; +$txt['sp-blocksAdd'] = 'Add Block'; +$txt['sp-blocksEdit'] = 'Edit Block'; +$txt['sp-blocksPreview'] = 'Preview'; +$txt['sp-blocksDefaultLabel'] = 'Untitled'; +$txt['sp-blocksDisabledBoth'] = 'Left and right side blocks are currently disabled'; +$txt['sp-blocksDisabledLeft'] = 'Left side blocks are currently disabled'; +$txt['sp-blocksDisabledRight'] = 'Right side blocks are currently disabled'; +$txt['sp-blocksContent'] = 'Content'; +$txt['sp-blocksColumn'] = 'Column'; +$txt['sp_admin_blocks_col_permissions'] = 'Permissions'; +$txt['sp_admin_blocks_permissions_set_custom'] = 'Custom'; +$txt['sp_admin_blocks_permissions_set_guests'] = 'Guests'; +$txt['sp_admin_blocks_permissions_set_members'] = 'Members'; +$txt['sp_admin_blocks_permissions_set_everyone'] = 'Everyone'; +$txt['sp_admin_blocks_col_custom_permissions'] = 'Custom Permissions'; +$txt['sp_admin_blocks_custom_permissions_membergroup'] = 'Membergroup'; +$txt['sp_admin_blocks_custom_permissions_allowed_short'] = 'A'; +$txt['sp_admin_blocks_custom_permissions_disallowed_short'] = 'X'; +$txt['sp_admin_blocks_custom_permissions_denied_short'] = 'D'; +$txt['sp_admin_blocks_custom_permissions_allowed'] = 'Allowed'; +$txt['sp_admin_blocks_custom_permissions_disallowed'] = 'Disallowed'; +$txt['sp_admin_blocks_custom_permissions_denied'] = 'Denied'; +$txt['sp-blocksRow'] = 'Order'; +$txt['sp-blocksForce'] = 'Not Collapsible'; +$txt['sp-blocksDisplayOptions'] = 'Display Options'; +$txt['sp-blocksAdvancedOptions'] = 'Advanced Options'; +$txt['sp-blocksShowBlock'] = 'Show Block On'; +$txt['sp-blocksOptionAllPages'] = 'All Pages'; +$txt['sp-blocksOptionAllActions'] = 'All Actions'; +$txt['sp-blocksOptionAllBoards'] = 'All Boards'; +$txt['sp-blocksOptionEverywhere'] = 'Everywhere'; +$txt['sp-blocksSelectActions'] = 'Select Actions'; +$txt['sp-blocksSelectBoards'] = 'Select Boards'; +$txt['sp-blocksSelectPages'] = 'Select Pages'; +$txt['sp_display_custom'] = 'Custom Display Options'; +$txt['sp-blocksStyleOptions'] = 'Style Options'; +$txt['sp-blocksTitleDefaultClass'] = 'Default Title Class'; +$txt['sp-blocksTitleCustomClass'] = 'Custom Title Class'; +$txt['sp-blocksTitleCustomStyle'] = 'Custom Title Style'; +$txt['sp-blocksBodyDefaultClass'] = 'Default Body Class'; +$txt['sp-blocksBodyCustomClass'] = 'Custom Body Class'; +$txt['sp-blocksBodyCustomStyle'] = 'Custom Body Style'; +$txt['sp-blocksNoTitle'] = 'No Title'; +$txt['sp-blocksNoBody'] = 'No Body'; + +// Block labels +$txt['sp_function_sp_userInfo_label'] = 'Member Information'; +$txt['sp_function_sp_latestMember_label'] = 'Latest Members'; +$txt['sp_function_sp_whosOnline_label'] = 'Who\'s Online'; +$txt['sp_function_sp_showPoll_label'] = 'Poll'; +$txt['sp_function_sp_boardStats_label'] = 'Board Statistics'; +$txt['sp_function_sp_quickSearch_label'] = 'Quick Search'; +$txt['sp_function_sp_topPoster_label'] = 'Top Poster'; +$txt['sp_function_sp_topStatsMember_label'] = 'Top Member Stats'; +$txt['sp_function_sp_topBoards_label'] = 'Top Boards'; +$txt['sp_function_sp_topTopics_label'] = 'Top Topics'; +$txt['sp_function_sp_recent_label'] = 'Recent Posts/Topics'; +$txt['sp_function_sp_boardNews_label'] = 'Board News'; +$txt['sp_function_sp_news_label'] = 'Forum News'; +$txt['sp_function_sp_attachmentImage_label'] = 'Recent Image Attachments'; +$txt['sp_function_sp_attachmentRecent_label'] = 'Recent Attachments'; +$txt['sp_function_sp_calendar_label'] = 'Calendar'; +$txt['sp_function_sp_calendarInformation_label'] = 'Calendar Information'; +$txt['sp_function_sp_rssFeed_label'] = 'RSS Feed'; +$txt['sp_function_sp_theme_select_label'] = 'Theme Selection'; +$txt['sp_function_sp_staff_label'] = 'Staff List'; +$txt['sp_function_sp_articles_label'] = 'Articles'; +$txt['sp_function_sp_shoutbox_label'] = 'Shoutbox'; +$txt['sp_function_sp_gallery_label'] = 'Gallery'; +$txt['sp_function_sp_arcade_label'] = 'Arcade'; +$txt['sp_function_sp_shop_label'] = 'Shop'; +$txt['sp_function_sp_blog_label'] = 'Blog'; +$txt['sp_function_sp_menu_label'] = 'Forum Menu'; +$txt['sp_function_sp_bbc_label'] = 'Custom BBC'; +$txt['sp_function_sp_html_label'] = 'Custom HTML'; +$txt['sp_function_sp_php_label'] = 'Custom PHP'; + +// Block descriptions +$txt['sp_function_sp_latestMember_desc'] = 'Displays the latest members and their registration dates.'; +$txt['sp_function_sp_userInfo_desc'] = 'Displays member information if the viewer is logged in, and a login box if the viewer is a guest.'; +$txt['sp_function_sp_whosOnline_desc'] = 'Displays the who\'s online list.'; +$txt['sp_function_sp_showPoll_desc'] = 'Displays a poll with voting options if the viewer can vote, or the results if the viewer is unable to vote.'; +$txt['sp_function_sp_boardStats_desc'] = 'Displays some statistical information about the forum.'; +$txt['sp_function_sp_quickSearch_desc'] = 'Displays a simple quick search form.'; +$txt['sp_function_sp_topPoster_desc'] = 'Displays the top posters with their post count and avatars.'; +$txt['sp_function_sp_topStatsMember_desc'] = 'Displays various types of member stats.'; +$txt['sp_function_sp_topBoards_desc'] = 'Displays a list of boards according to their activity.'; +$txt['sp_function_sp_topTopics_desc'] = 'Displays a list topics according to their activity.'; +$txt['sp_function_sp_recent_desc'] = 'Displays a list of the forums recent posts or topics.'; +$txt['sp_function_sp_boardNews_desc'] = 'Displays a list of posts from a selected board.'; +$txt['sp_function_sp_news_desc'] = 'Displays a random news line.'; +$txt['sp_function_sp_attachmentImage_desc'] = 'Displays a list of recently attached images.'; +$txt['sp_function_sp_attachmentRecent_desc'] = 'Displays a list of recent attachments.'; +$txt['sp_function_sp_calendar_desc'] = 'Displays a full month calendar with all events.'; +$txt['sp_function_sp_calendarInformation_desc'] = 'Displays calendar information such as birthdays, events and holidays.'; +$txt['sp_function_sp_rssFeed_desc'] = 'Displays an RSS Feed.'; +$txt['sp_function_sp_theme_select_desc'] = 'Displays a list of available themes and allows members to select one.'; +$txt['sp_function_sp_staff_desc'] = 'Displays list of forum staff with their position and avatar.'; +$txt['sp_function_sp_articles_desc'] = 'Displays recent or random articles.'; +$txt['sp_function_sp_shoutbox_desc'] = 'Displays a shoutbox.'; +$txt['sp_function_sp_gallery_desc'] = 'Displays a list of recent gallery items.'; +$txt['sp_function_sp_arcade_desc'] = 'Displays various statistics from the arcade if an arcade mod is installed.'; +$txt['sp_function_sp_shop_desc'] = 'Displays the richest members or various items from the shop if a shop mod is installed.'; +$txt['sp_function_sp_blog_desc'] = 'Displays various information from the forum blog.'; +$txt['sp_function_sp_menu_desc'] = 'Displays a vertical forum menu.'; +$txt['sp_function_sp_bbc_desc'] = 'A custom block where BBC content can be added.'; +$txt['sp_function_sp_html_desc'] = 'A custom block where HTML content can be added.'; +$txt['sp_function_sp_php_desc'] = 'A custom block where PHP content can be added.'; + +// Block parameters +$txt['sp_param_sp_latestMember_limit'] = 'Members to Show'; +$txt['sp_param_sp_whosOnline_online_today'] = 'Users Online Today'; +$txt['sp_param_sp_boardStats_averages'] = 'Show Averages'; +$txt['sp_param_sp_topPoster_limit'] = 'Top Posters to Display'; +$txt['sp_param_sp_topPoster_type'] = 'Display'; +$txt['sp_param_sp_topStatsMember_type'] = 'Type of the Top Member List'; +$txt['sp_param_sp_topStatsMember_limit'] = 'Members to display'; +$txt['sp_param_sp_topStatsMember_enable_label'] = 'Enable label for list'; +$txt['sp_param_sp_topStatsMember_list_label'] = 'List label'; +$txt['sp_param_sp_topStatsMember_sort_asc'] = 'Sort in reverse order'; +$txt['sp_param_sp_topStatsMember_last_active_limit'] = 'Remove inactive Members from the List
(Time in days)'; +$txt['sp_param_sp_recent_limit'] = 'Recent Posts or Topics to Display'; +$txt['sp_param_sp_recent_type'] = 'Display'; +$txt['sp_param_sp_recent_display'] = 'Display type'; +$txt['sp_param_sp_recent_boards'] = 'Include boards'; +$txt['sp_param_sp_topTopics_type'] = 'Sorting Type'; +$txt['sp_param_sp_topTopics_limit'] = 'Topics to Display'; +$txt['sp_param_sp_topBoards_limit'] = 'Boards to Display'; +$txt['sp_param_sp_showPoll_topic'] = 'Topic ID'; +$txt['sp_param_sp_showPoll_type'] = 'Type'; +$txt['sp_param_sp_boardNews_board'] = 'Boards'; +$txt['sp_param_sp_boardNews_limit'] = 'Topics to Display'; +$txt['sp_param_sp_boardNews_start'] = 'Starting Post ID'; +$txt['sp_param_sp_boardNews_length'] = 'Maximum Characters'; +$txt['sp_param_sp_boardNews_avatar'] = 'Display Avatars'; +$txt['sp_param_sp_boardNews_per_page'] = 'Posts Per Page'; +$txt['sp_param_sp_attachmentImage_limit'] = 'Images to Display'; +$txt['sp_param_sp_attachmentImage_direction'] = 'List Direction'; +$txt['sp_param_sp_attachmentImage_disablePoster'] = 'Remove Image Poster\'s Name'; +$txt['sp_param_sp_attachmentImage_disableDownloads'] = 'Remove image Download'; +$txt['sp_param_sp_attachmentImage_disableLink'] = 'Remove Image Download Link'; +$txt['sp_param_sp_attachmentRecent_limit'] = 'Attachments to Display'; +$txt['sp_param_sp_calendar_events'] = 'Show Events'; +$txt['sp_param_sp_calendar_birthdays'] = 'Show Birthdays'; +$txt['sp_param_sp_calendar_holidays'] = 'Show Holidays'; +$txt['sp_param_sp_calendarInformation_events'] = 'Show Events'; +$txt['sp_param_sp_calendarInformation_future'] = 'Number of days in future to show events'; +$txt['sp_param_sp_calendarInformation_birthdays'] = 'Show Birthdays'; +$txt['sp_param_sp_calendarInformation_holidays'] = 'Show Holidays'; +$txt['sp_param_sp_rssFeed_url'] = 'Feed URL'; +$txt['sp_param_sp_rssFeed_show_title'] = 'Show Title'; +$txt['sp_param_sp_rssFeed_show_content'] = 'Show Content'; +$txt['sp_param_sp_rssFeed_show_date'] = 'Show Date'; +$txt['sp_param_sp_rssFeed_strip_preserve'] = 'Tags to Preserve'; +$txt['sp_param_sp_rssFeed_count'] = 'Items to Show'; +$txt['sp_param_sp_rssFeed_limit'] = 'Character Limit'; +$txt['sp_param_sp_staff_lmod'] = 'Disable Local Moderators'; +$txt['sp_param_sp_articles_category'] = 'Category'; +$txt['sp_param_sp_articles_limit'] = 'Articles to Display'; +$txt['sp_param_sp_articles_type'] = 'Display Type'; +$txt['sp_param_sp_articles_image'] = 'Image'; +$txt['sp_param_sp_shoutbox_shoutbox'] = 'Shoutbox to Display'; +$txt['sp_param_sp_gallery_limit'] = 'Items to Display'; +$txt['sp_param_sp_gallery_type'] = 'Display'; +$txt['sp_param_sp_gallery_direction'] = 'List Direction'; +$txt['sp_param_sp_arcade_limit'] = 'Items to display'; +$txt['sp_param_sp_arcade_type'] = 'Display'; +$txt['sp_param_sp_shop_style'] = 'Display'; +$txt['sp_param_sp_shop_limit'] = 'Items to display'; +$txt['sp_param_sp_shop_type'] = 'Money type'; +$txt['sp_param_sp_shop_sort'] = 'Item type'; +$txt['sp_param_sp_blog_limit'] = 'Items to Display'; +$txt['sp_param_sp_blog_type'] = 'Item Type'; +$txt['sp_param_sp_blog_sort'] = 'Display'; +$txt['sp_param_sp_html_content'] = 'Custom HTML'; +$txt['sp_param_sp_bbc_content'] = 'Custom BBC'; +$txt['sp_param_sp_php_content'] = 'Custom PHP'; + +// Parameter options +$txt['sp_param_sp_topPoster_type_options'] = 'All Time|Today|This Week|This Month'; +$txt['sp_param_sp_topStatsMember_type_options'] = 'Total Time Logged In|Posts|Good Karma|Bad Karma|Total Karma|Thank-O-Matic Top Given|Thank-O-Matic Top Received|Automatic Karma Good|Automatic Karma Bad|Automatic Karma Total|Advanced Reputation System Best|Advanced Reputation System Worst'; +$txt['sp_param_sp_recent_type_options'] = 'Posts|Topics'; +$txt['sp_param_sp_recent_display_options'] = 'Compact|Full'; +$txt['sp_param_sp_topTopics_type_options'] = 'Replies|Views'; +$txt['sp_param_sp_showPoll_type_options'] = 'Normal|Recent|Random'; +$txt['sp_param_sp_attachmentImage_direction_options'] = 'Vertical|Horizontal'; +$txt['sp_param_sp_articles_type_options'] = 'Latest|Random'; +$txt['sp_param_sp_articles_image_options'] = 'None|Poster Avatar|Category Image'; +$txt['sp_param_sp_gallery_type_options'] = 'Latest|Random'; +$txt['sp_param_sp_gallery_direction_options'] = 'Vertical|Horizontal'; +$txt['sp_param_sp_arcade_type_options'] = 'Most Played|Best Players|Longest Champ'; +$txt['sp_param_sp_shop_style_options'] = 'Members|Items'; +$txt['sp_param_sp_shop_type_options'] = 'Total|Pocket|Bank'; +$txt['sp_param_sp_shop_sort_options'] = 'Recent|Random'; +$txt['sp_param_sp_blog_type_options'] = 'Articles|Blogs'; +$txt['sp_param_sp_blog_sort_options'] = 'Latest|Random'; + +// Articles area +$txt['sp-adminArticleListName'] = 'Article List'; +$txt['sp-adminArticleListDesc'] = 'This page displays a list of all topics that have been added as articles. These can be modified by selecting the appropriate options.'; +$txt['sp-adminArticleAddName'] = 'Add Article'; +$txt['sp-adminArticleAddDesc'] = 'This page enables articles to be added to the portal page.'; +$txt['sp-adminArticleAddNoTopics'] = 'This board has no remaining topics that can be added as articles.'; + +// Article list +$txt['sp-articlesRemove'] = 'Remove Selected'; +$txt['sp-articlesConfirm'] = 'Are you sure you want to delete these articles?'; +$txt['sp-articlesDeleteConfirm'] = 'Are you sure you want to delete this article?'; + +// Add/Edit articles +$txt['sp-articlesAdd'] = 'Add Article'; +$txt['sp-articlesEdit'] = 'Edit Article'; +$txt['sp-articlesCategory'] = 'Article Category'; +$txt['sp-articlesApproved'] = 'Approved'; + +// Categories area +$txt['sp-adminCategoryListName'] = 'Category List'; +$txt['sp-adminCategoryListDesc'] = 'This page displays a list of article categories that have been created. These can be modified by selecting the appropriate options.'; +$txt['sp-adminCategoryAddName'] = 'Add Category'; +$txt['sp-adminCategoryAddDesc'] = 'This page enables new categories to be added for articles to be placed in.'; + +// Category list +$txt['sp-categoriesCategories'] = 'Categories'; + +// Add/Edit category +$txt['sp-categoriesAdd'] = 'Add Category'; +$txt['sp-categoriesEdit'] = 'Edit Category'; +$txt['sp-categoriesName'] = 'Name'; +$txt['sp-categoriesPicture'] = 'Image URL'; +$txt['sp-categoriesPublish'] = 'Publish on Portal'; + +// Delete category +$txt['sp-categoriesDelete'] = 'Delete Category'; +$txt['sp-categoriesDeleteCount'] = 'There are %s article(s) in this category.'; +$txt['sp-categoriesDeleteOption1'] = 'Do you want to move these articles to another category?'; +$txt['sp-categoriesDeleteOption2'] = 'By deleting this category your articles will also be deleted.'; +$txt['sp-categoriesDeleteConfirm'] = 'Are you sure you wish to delete this category?'; +$txt['sp-categoriesMove'] = 'Move'; +$txt['sp-categoriesMoveTo'] = 'Move To'; + +// Block list titles +$txt['sp-adminColumnType'] = 'Type'; +$txt['sp-adminColumnMove'] = 'Move'; + +// Article list titles +$txt['sp-adminColumnTopic'] = 'Topic'; +$txt['sp-adminColumnBoard'] = 'Board'; +$txt['sp-adminColumnPoster'] = 'Poster'; +$txt['sp-adminColumnTime'] = 'Time'; +$txt['sp-adminColumnCategory'] = 'Category'; +$txt['sp-adminColumnApproved'] = 'Approved'; + +// Category list titles +$txt['sp-adminColumnPicture'] = 'Picture'; +$txt['sp-adminColumnArticles'] = 'Articles'; +$txt['sp-adminColumnPublish'] = 'Publish'; + +// Pages Area +$txt['sp_admin_pages_title'] = 'Pages'; +$txt['sp_admin_pages_list'] = 'Page List'; +$txt['sp_admin_pages_add'] = 'Add Page'; +$txt['sp_admin_pages_edit'] = 'Edit Page'; +$txt['sp_admin_pages_remove'] = 'Remove Pages'; +$txt['sp_admin_pages_preview'] = 'Preview'; +$txt['sp_admin_pages_general'] = 'General Settings'; +$txt['sp_admin_pages_style'] = 'Style Options'; + +$txt['sp_admin_pages_desc'] = 'You can create and manage SimplePortal pages in this area.'; +$txt['sp_pages_remove_confirm'] = 'Are you sure that you want to remove the selected pages?'; +$txt['sp_admin_pages_delete_confirm'] = 'Are you sure you want to delete this page?'; +$txt['sp_error_no_pages'] = 'There are no pages available.'; +$txt['sp_error_page_name_empty'] = 'Sorry, you left the page name empty.'; +$txt['sp_error_page_namespace_empty'] = 'Sorry, you left the page ID empty.'; +$txt['sp_error_page_namespace_duplicate'] = 'Sorry, that page ID is already in use.'; +$txt['sp_error_page_namespace_invalid_chars'] = 'Sorry, there are invalid characters in the page ID. Page ID\'s can only contain letters, numbers and underscores.'; +$txt['sp_error_page_namespace_numeric'] = 'Sorry, page ID\'s cannot be only numbers. Page ID\'s need letters, and or an underscore'; + +$txt['sp_admin_pages_col_title'] = 'Title'; +$txt['sp_admin_pages_col_namespace'] = 'Page ID'; +$txt['sp_admin_pages_col_body'] = 'Body'; +$txt['sp_admin_pages_col_type'] = 'Type'; +$txt['sp_admin_pages_col_views'] = 'Views'; +$txt['sp_admin_pages_col_status'] = 'Active'; +$txt['sp_admin_pages_col_actions'] = 'Actions'; +$txt['sp_admin_pages_col_permissions'] = 'Permissions'; +$txt['sp_admin_pages_permissions_set_custom'] = 'Custom'; +$txt['sp_admin_pages_permissions_set_guests'] = 'Guests'; +$txt['sp_admin_pages_permissions_set_members'] = 'Members'; +$txt['sp_admin_pages_permissions_set_everyone'] = 'Everyone'; +$txt['sp_admin_pages_col_custom_permissions'] = 'Custom Permissions'; +$txt['sp_admin_pages_custom_permissions_membergroup'] = 'Membergroup'; +$txt['sp_admin_pages_custom_permissions_allowed_short'] = 'A'; +$txt['sp_admin_pages_custom_permissions_disallowed_short'] = 'X'; +$txt['sp_admin_pages_custom_permissions_denied_short'] = 'D'; +$txt['sp_admin_pages_custom_permissions_allowed'] = 'Allowed'; +$txt['sp_admin_pages_custom_permissions_disallowed'] = 'Disallowed'; +$txt['sp_admin_pages_custom_permissions_denied'] = 'Denied'; +$txt['sp_admin_pages_col_blocks'] = 'Blocks'; +$txt['sp_admin_pages_activate'] = 'Activate'; +$txt['sp_admin_pages_deactivate'] = 'Deactivate'; + +$txt['sp_pages_default_title'] = 'Untitled Page'; + +$txt['sp_pages_type_bbc'] = 'BBC'; +$txt['sp_pages_type_html'] = 'HTML'; +$txt['sp_pages_type_php'] = 'PHP'; + +// Shoutboxes Area +$txt['sp_admin_shoutbox_title'] = 'Shoutbox'; +$txt['sp_admin_shoutbox_list'] = 'Shoutbox List'; +$txt['sp_admin_shoutbox_add'] = 'Add Shoutbox'; +$txt['sp_admin_shoutbox_edit'] = 'Edit Shoutbox'; +$txt['sp_admin_shoutbox_prune'] = 'Prune Shoutbox'; +$txt['sp_admin_shoutbox_remove'] = 'Remove Shoutboxes'; + +$txt['sp_admin_shoutbox_desc'] = 'You can create and manage SimplePortal shoutboxes in this area.'; +$txt['sp_shoutbox_remove_confirm'] = 'Are you sure that you want to remove the selected shoutboxes?'; +$txt['sp_admin_shoutbox_delete_confirm'] = 'Are you sure you want to delete this shoutbox?'; +$txt['sp_error_no_shoutbox'] = 'There are no shoutboxes available.'; +$txt['sp_error_shoutbox_name_duplicate'] = 'Sorry, there is already a shoutbox with that name.'; + +$txt['sp_admin_shoutbox_col_name'] = 'Name'; +$txt['sp_admin_shoutbox_col_shouts'] = 'Shouts'; +$txt['sp_admin_shoutbox_col_caching'] = 'Caching'; +$txt['sp_admin_shoutbox_col_status'] = 'Status'; +$txt['sp_admin_shoutbox_col_actions'] = 'Actions'; +$txt['sp_admin_shoutbox_col_permissions'] = 'Permissions'; +$txt['sp_admin_shoutbox_permissions_set_custom'] = 'Custom'; +$txt['sp_admin_shoutbox_permissions_set_guests'] = 'Guests'; +$txt['sp_admin_shoutbox_permissions_set_members'] = 'Members'; +$txt['sp_admin_shoutbox_permissions_set_everyone'] = 'Everyone'; +$txt['sp_admin_shoutbox_col_custom_permissions'] = 'Custom Permissions'; +$txt['sp_admin_shoutbox_custom_permissions_membergroup'] = 'Membergroup'; +$txt['sp_admin_shoutbox_custom_permissions_allowed_short'] = 'A'; +$txt['sp_admin_shoutbox_custom_permissions_disallowed_short'] = 'X'; +$txt['sp_admin_shoutbox_custom_permissions_denied_short'] = 'D'; +$txt['sp_admin_shoutbox_custom_permissions_allowed'] = 'Allowed'; +$txt['sp_admin_shoutbox_custom_permissions_disallowed'] = 'Disallowed'; +$txt['sp_admin_shoutbox_custom_permissions_denied'] = 'Denied'; +$txt['sp_admin_shoutbox_col_moderators'] = 'Moderators'; +$txt['sp_admin_shoutbox_col_reverse'] = 'Reverse Order'; +$txt['sp_admin_shoutbox_activate'] = 'Activate'; +$txt['sp_admin_shoutbox_deactivate'] = 'Deactivate'; + +$txt['sp_shoutbox_default_name'] = 'Untitled Shoutbox'; + +$txt['sp_admin_shoutbox_col_warning'] = 'Warning'; +$txt['sp_admin_shoutbox_col_bbc'] = 'Allowed BBC'; +$txt['sp_admin_shoutbox_col_height'] = 'Height(pixels)'; +$txt['sp_admin_shoutbox_col_num_show'] = 'Shouts to display'; +$txt['sp_admin_shoutbox_col_num_max'] = 'Maximum shouts'; +$txt['sp_admin_shoutbox_col_refresh'] = 'Auto refresh(seconds)'; + +$txt['sp_admin_shoutbox_opt_all'] = 'Delete all shouts'; +$txt['sp_admin_shoutbox_opt_days'] = 'Delete shouts older than a number of days'; +$txt['sp_admin_shoutbox_opt_member'] = 'Delete shouts posted by a member'; + +$txt['sp_admin_shoutbox_block_redirect_message'] = '

Congratulations, you have created a new shoutbox!

+

Although it won\'t be displayed anywhere within your forum yet. You will need to create a shoutbox block before your users can use the shoutbox.

+

Click here to create a new shoutbox block for this shoutbox.

+

Click here to continue to your list of shoutboxes.

'; + +// General titles +$txt['sp-adminColumnAction'] = 'Action'; +$txt['sp-adminColumnName'] = 'Name'; + +// Miscellaneous strings +$txt['sp-positionLeft'] = 'Left'; +$txt['sp-positionTop'] = 'Top'; +$txt['sp-positionBottom'] = 'Bottom'; +$txt['sp-positionRight'] = 'Right'; +$txt['sp-positionHeader'] = 'Header'; +$txt['sp-positionFooter'] = 'Footer'; +$txt['sp-placementBefore'] = 'Before'; +$txt['sp-placementAfter'] = 'After'; +$txt['sp-placementUnchanged'] = 'Unchanged'; +$txt['sp-stateYes'] = 'Yes'; +$txt['sp-stateNo'] = 'No'; + +// Information area +$txt['sp-info_title'] = 'Information'; +$txt['sp-info_desc'] = 'Some useful system, and SimplePortal information.'; +$txt['sp-info_live'] = 'Live from SimplePortal...'; +$txt['sp-info_no_live'] = 'Sorry! At this time you are unable to connect to simpleportal.net\'s latest news file.'; +$txt['sp-info_general'] = 'General Information'; +$txt['sp-info_versions'] = 'Version Information'; +$txt['sp-info_your_version'] = 'Your Version'; +$txt['sp-info_current_version'] = 'Current Version'; +$txt['sp-info_managers'] = 'Managers'; +$txt['sp-info_intro'] = 'The SimplePortal Team wants to thank everyone who helped make SimplePortal what it is today, and the Simple Machines Team for the great forum software, SMF. It wouldn\'t have been possible without you, our users, and SMF.'; +$txt['sp-info_team'] = 'The Team'; +$txt['sp-info_special'] = 'Special Thanks'; +$txt['sp-info_and'] = 'and'; +$txt['sp-info_anyone'] = 'For anyone we may have missed, thank you!'; +$txt['sp-info_groups_pm'] = 'Project Managers'; +$txt['sp-info_groups_dev'] = 'Developers'; +$txt['sp-info_groups_support'] = 'Support Specialists'; +$txt['sp-info_groups_customize'] = 'Customizers'; +$txt['sp-info_groups_language'] = 'Language Managers'; +$txt['sp-info_groups_marketing'] = 'Marketing'; +$txt['sp-info_groups_beta'] = 'Beta Testers'; +$txt['sp-info_groups_translators'] = 'Language Translators'; +$txt['sp-info_translators_message'] = 'Thank you for your efforts in the internationalization of SimplePortal.'; +$txt['sp-info_groups_founder'] = 'Founding Father of SimplePortal'; +$txt['sp-info_groups_orignal_pm'] = 'Original Project Managers'; +$txt['sp-info_fam_fam'] = 'Pretty Icons'; +$txt['sp-info_fam_fam_message'] = 'Mark James for his Fam Fam Fam Silk Icons.'; +$txt['sp-info_contribute'] = 'Did you find SimplePortal useful? Contribute to the project!'; + +// Permissions +$txt['permissiongroup_sp'] = 'SimplePortal'; +$txt['permissiongroup_simple_sp'] = 'SimplePortal'; +$txt['permissionname_sp_admin'] = 'Administrate portal'; +$txt['permissionhelp_sp_admin'] = 'This permission allows users to administrate SimplePortal.'; +$txt['permissionname_sp_manage_settings'] = 'Manage portal settings'; +$txt['permissionhelp_sp_manage_settings'] = 'This permission allows users to manage SimplePortal settings.'; +$txt['permissionname_sp_manage_blocks'] = 'Manage portal blocks'; +$txt['permissionhelp_sp_manage_blocks'] = 'This permission allows users to manage SimplePortal blocks.'; +$txt['permissionname_sp_manage_articles'] = 'Manage portal articles'; +$txt['permissionhelp_sp_manage_articles'] = 'This permission allows users to manage SimplePortal articles.'; +$txt['permissionname_sp_manage_pages'] = 'Manage portal pages'; +$txt['permissionhelp_sp_manage_pages'] = 'This permission allows users to manage SimplePortal pages.'; +$txt['permissionname_sp_manage_shoutbox'] = 'Manage portal shoutboxes'; +$txt['permissionhelp_sp_manage_shoutbox'] = 'This permission allows users to manage SimplePortal shoutboxes.'; +$txt['permissionname_sp_add_article'] = 'Can add article'; +$txt['permissionhelp_sp_add_article'] = 'This permission allows users to add articles.'; +$txt['permissionname_sp_auto_article_approval'] = 'Automatic article approval'; +$txt['permissionhelp_sp_auto_article_approval'] = 'This permission allows users to add articles without requiring approval.'; +$txt['permissionname_sp_remove_article'] = 'Can remove article'; +$txt['permissionhelp_sp_remove_article'] = 'This permission allows users to remove articles.'; + +// Compatibility strings +$txt['sp-adminCatHelp'] = 'Here you can manage and configure SimplePortal.'; +$txt['sp-adminCatDesc'] = 'Here you can manage and configure SimplePortal.'; + +?> \ No newline at end of file diff --git a/Themes/default/languages/SPortalHelp.english-utf8.php b/Themes/default/languages/SPortalHelp.english-utf8.php new file mode 100644 index 0000000..eb6a22c --- /dev/null +++ b/Themes/default/languages/SPortalHelp.english-utf8.php @@ -0,0 +1,174 @@ +
+Disabled: This will completely disable the portal.

+Frontpage: This is the default setting. The portal page will greet viewers instead of the board index. Members will be able to access the board index by using the "forum" action, which can be accessed through the "forum" button.

+Integration: This will disable the portal page. Blocks are only usable in forum.

+Standalone: This will enable the portal to be displayed at a different url, away from the forum. The portal page appears in the url defined for the "Standalone URL" option. For details, check the PortalStandalone.php file found inside the forum root.'; +$helptxt['sp_maintenance'] = 'When maintenance is enabled, portal is only visible by members with Moderate SimplePortal permission.'; +$helptxt['sp_standalone_url'] = 'Full URL to the standalone file.

Example: http://myforum.com/portal.php'; +$helptxt['portaltheme'] = 'Select the theme which will be used for the portal.'; +$helptxt['sp_disableForumRedirect'] = 'If this box is unchecked, users will be redirected to the portal after they login or logout. If this box is checked, then users will be redirected to the BoardIndex.'; +$helptxt['sp_disableColor'] = 'If the Member Color Link mod is installed, this will disable the mod on the portal (except in the who\'s online list).'; +$helptxt['sp_disable_random_bullets'] = 'Disables random coloring for bullet images used in portal lists.'; +$helptxt['sp_disable_php_validation'] = 'Disables validation of PHP block codes, which is to prevent syntax and database errors in code.'; +$helptxt['sp_disable_side_collapse'] = 'Disables ability to collapse the left and right sides of the portal.'; +$helptxt['sp_resize_images'] = 'Enables resizing images in articles and board news to 300x300px, to prevent possible overflows.'; + +// Block settings +$helptxt['showleft'] = 'This will enable left side blocks on the portal and inside the forum.'; +$helptxt['showright'] = 'This will enable right side blocks on the portal and inside the forum.'; +$helptxt['leftwidth'] = 'If left side blocks are enabled, their width can be specified here. The width can be specified in pixels (px) or in percentages (%).'; +$helptxt['rightwidth'] = 'If right side blocks are enabled, their width can be specified here. The width can be specified in pixels (px) or in percentages (%).'; +$helptxt['sp_enableIntegration'] = 'This setting enables blocks inside the forum. It allows the advanced Display Options for each block to be specified.'; +$helptxt['sp_IntegrationHide'] = 'Hide blocks in certain forum sections. The Display blocks in Forum setting must be enabled for this to work.'; + +// Article settings +$helptxt['articleactive'] = 'This setting enables articles to be displayed on the portal.'; +$helptxt['articleperpage'] = 'This sets the maximum amount of articles shown per page.'; +$helptxt['articlelength'] = 'This setting allows a limit to be set on the amount of characters an article can display on the portal page. If the article exceeds this limit it will be shortened and have an ellipsis (...) link on the end, which allows the user to view the entire article.'; +$helptxt['articleavatar'] = 'If this setting is enabled the authors avatar will be shown along with each article.'; + +// Blocks area +$helptxt['sp_BlocksArea'] = 'Blocks are boxes which can be displayed on the portal or inside the forum. This section enables existing blocks to be modified, and new ones to be created.'; + +// Block list +$helptxt['sp-blocksLeftList'] = 'These blocks are displayed on the left side of the portal and forum.'; +$helptxt['sp-blocksTopList'] = 'These blocks are centered at the top of the portal and forum.'; +$helptxt['sp-blocksBottomList'] = 'These blocks are centered at the bottom of the portal and forum.'; +$helptxt['sp-blocksRightList'] = 'These blocks are displayed on the right side of the portal and forum.'; +$helptxt['sp-blocksHeaderList'] = 'These blocks are displayed on the top of the portal and forum.'; +$helptxt['sp-blocksFooterList'] = 'These blocks are displayed on the bottom of the portal and forum.'; + +// Add/Edit blocks +$helptxt['sp-blocksAdd'] = 'This area enables the selected block to be customised and configured.'; +$helptxt['sp-blocksSelectType'] = 'This area enables blocks to be created for the portal page. Pre-built blocks or custom content blocks can be created easily by selecting the appropriate options.'; +$helptxt['sp-blocksEdit'] = 'This area enables the selected block to be customised and configured.'; +$helptxt['sp-blocksDisplayOptions'] = 'This area allows you to select on which pages block will appear.'; +$helptxt['sp-blocksCustomDisplayOptions'] = 'Custom display options allows a more advanced control over where to display the block with its special syntax.

+Special actions include:

+all: every page in forum.
+portal: portal page and it\'s sub-actions.
+forum: board index.
+sforum: all actions and boards, except portal.
+allaction: all actions.
+allboard: all boards.

+Wavy (~)
+This symbol acts as a wildcard, allowing you to include dynamic actions like ../index.php?issue=* or ../index.php?game=*. Used as ~action

+Idkin (|)
+Another wildcard sybmol which allows you to specify an exact value for a dynamic action like ../index.php?issue=1.0 or ../index.php?game=xyz. Should be used with wavy and after the action like; ~action|value

+Negator (-)
+This symbol is to exclude regular and dynamic actions. Should be used before the action name for regular actions and before the wavy for dynamic actions. Used as -action and -~action'; +$helptxt['sp-blocksStyleOptions'] = 'These options allow you to specify CSS styling for each blocks.'; + +// Articles area +$helptxt['sp_ArticlesArea'] = 'Articles are topics (first post only) which are displayed on the portal. This section enables existing articles to be modified, and new ones to be created for the portal.'; + +// Add/Edit articles +$helptxt['sp-articlesAdd'] = 'This area allows you to add articles to categories from your boards.'; +$helptxt['sp-articlesEdit'] = 'In this area you change the category or status of the articles.'; +$helptxt['sp-articlesCategory'] = 'Select a category for this article.'; +$helptxt['sp-articlesApproved'] = 'Approved articles will appear on the portal articles area.'; +$helptxt['sp-articlesTopics'] = 'Select the topics to be displayed as articles on the portal.'; +$helptxt['sp-articlesBoards'] = 'Select a board to search for topics.'; + +// Categories area +$helptxt['sp_CategoriesArea'] = 'Categories hold articles. This section enables existing categories to be modified, and new ones to be created for articles. To create an article there must be at least one category.'; + +// Add/Edit categories +$helptxt['sp-categoriesAdd'] = 'This section enables categories to be created for articles. To create articles there must be at least one category.'; +$helptxt['sp-categoriesEdit'] = 'This section enables categories to be modified.'; +$helptxt['sp-categoriesCategories'] = 'This page displays a list of the current article categories. To create articles there must be at least one category.'; +$helptxt['sp-categoriesDelete'] = 'Deleting a category will either delete the articles in it, or move them to another category.'; + +// Pages area +$helptxt['sp_PagesArea'] = 'Pages are BBC, PHP or HTML code blocks that are shown on their own page within your forum. This section allows you to create, edit and configure your pages.'; + +// Shoutbox area +$helptxt['sp_ShoutboxArea'] = 'Shoutboxes need to be created in this section. This section allows shoutboxes to be created and configured. A shoutbox block will then need to be used to show the shoutbox that is created.'; + +// Add/Edit shoutboxes +$helptxt['sp-shoutboxesWarning'] = 'The warning message that you set here will be shown in the shoutbox, anyone using the shoutbox will see this message.'; +$helptxt['sp-shoutboxesBBC'] = 'This setting allows you to choose the BBC that can be used in this shoutbox.

Hold down the CTRL key to select or deselect a particular BBC.

If you want to select a series of consecutive BBC, then click on the first BBC that you want to select, hold down the SHIFT key, then click on the last BBC that you want to select.'; + +$helptxt['sp_permissions'] = 'This option enables permissions to be used on blocks. The first three options are the simplest to use and understand. +
    +
  • Guests: Any user who is not registered or logged in will see this block. Logged-in users (including Administrators) will not see this block.
  • +
  • Members: Any user who is logged in (including Administrators) will see this block.
  • +
  • Everyone: All users, whether they are logged in or not, will see this block.
  • +
  • Custom: Select this to show the Custom Permissions area. In the Custom Permissions Settings, there are three options to choose for each group. +
      +
    • A: Allowed, any user of this group will see this block.
    • +
    • X: Disallowed, any user of this group will not see this block by default. The user may see this block if they are part of a group with Allowed permissions.
    • +
    • D: Denied, any user of this group will never see this block. This overrides the Allowed setting for any group a user is part of, so be careful with this permission.
    • +
    +
  • +
'; + +// Block parameters +$helptxt['sp_param_sp_latestMember_limit'] = 'How many members to display.'; +$helptxt['sp_param_sp_boardStats_averages'] = 'Display average statistics.'; +$helptxt['sp_param_sp_topPoster_limit'] = 'How many top posters to display.'; +$helptxt['sp_param_sp_topPoster_type'] = 'Time period to show top posters from.'; +$helptxt['sp_param_sp_recent_limit'] = 'How many recent posts or topics to display.'; +$helptxt['sp_param_sp_recent_type'] = 'Display recent posts or topics.'; +$helptxt['sp_param_sp_recentPosts_limit'] = 'How many recent posts to display.'; +$helptxt['sp_param_sp_recentTopics_limit'] = 'How many recent topics to display.'; +$helptxt['sp_param_sp_topTopics_type'] = 'Sort topics by replies or views.'; +$helptxt['sp_param_sp_topTopics_limit'] = 'How many topics to display.'; +$helptxt['sp_param_sp_topBoards_limit'] = 'How many boards to display.'; +$helptxt['sp_param_sp_showPoll_topic'] = 'The ID of the topic containing the poll to be displayed.'; +$helptxt['sp_param_sp_showPoll_type'] = 'Select the way polls should be displayed. Normal enables a specific poll to be called by the topic ID, Recent displays the most recently posted poll, and random displays a random poll.'; +$helptxt['sp_param_sp_boardNews_board'] = 'The ID of the board where the topics come from. Leave empty to fetch topics from all visible boards.'; +$helptxt['sp_param_sp_boardNews_limit'] = 'The maximum number of news items to be displayed.'; +$helptxt['sp_param_sp_boardNews_start'] = 'The ID of a particular post to start with (otherwise the first result will be used).'; +$helptxt['sp_param_sp_boardNews_length'] = 'If specified, posts exceeding this limit will be shortened and have an ellipsis (...), or a "Read More" link placed on the end.'; +$helptxt['sp_param_sp_boardNews_avatar'] = 'Enables avatars to be displayed for the member who posted the board news.'; +$helptxt['sp_param_sp_boardNews_per_page'] = 'How many posts to display per page. Leave empty to disable pagination.'; +$helptxt['sp_param_sp_attachmentImage_limit'] = 'How many recently attached images to display.'; +$helptxt['sp_param_sp_attachmentImage_direction'] = 'Attachment images can be aligned horizontally or vertically.'; +$helptxt['sp_param_sp_attachmentRecent_limit'] = 'How many recent attachments to display.'; +$helptxt['sp_param_sp_calendar_events'] = 'Enables events from the calendar to be displayed.'; +$helptxt['sp_param_sp_calendar_birthdays'] = 'Displays birthdays from the calendar.'; +$helptxt['sp_param_sp_calendar_holidays'] = 'Displays holidays from the calendar.'; +$helptxt['sp_param_sp_calendarInformation_events'] = 'Enables events from the calendar to be displayed.'; +$helptxt['sp_param_sp_calendarInformation_future'] = 'Allows you to choose the number of days into the future from which upcoming calendar events will be shown. This requires the ability to display events from the calendar. To display only events for today, use "0".'; +$helptxt['sp_param_sp_calendarInformation_birthdays'] = 'Displays birthdays from the calendar.'; +$helptxt['sp_param_sp_calendarInformation_holidays'] = 'Displays holidays from the calendar.'; +$helptxt['sp_param_sp_rssFeed_url'] = 'Enter the full URL of the RSS feed.'; +$helptxt['sp_param_sp_rssFeed_show_title'] = 'Show feed titles.'; +$helptxt['sp_param_sp_rssFeed_show_content'] = 'Show feed contents.'; +$helptxt['sp_param_sp_rssFeed_show_date'] = 'Show feed dates.'; +$helptxt['sp_param_sp_rssFeed_strip_preserve'] = 'HTML tags to preserve in feed content separated by commas.'; +$helptxt['sp_param_sp_rssFeed_count'] = 'How many items to display.'; +$helptxt['sp_param_sp_rssFeed_limit'] = 'How many characters to display from the RSS feeds content.'; +$helptxt['sp_param_sp_staff_lmod'] = 'Disables Local Moderators from being listed.'; +$helptxt['sp_param_sp_articles_category'] = 'The category to display articles from.'; +$helptxt['sp_param_sp_articles_limit'] = 'How many articles to display.'; +$helptxt['sp_param_sp_articles_type'] = 'Displays random articles, or the latest articles.'; +$helptxt['sp_param_sp_articles_image'] = 'Enables a category image, avatar, or nothing to be displayed on the article.'; +$helptxt['sp_param_sp_gallery_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_gallery_type'] = 'Displays random or the latest gallery items.'; +$helptxt['sp_param_sp_gallery_direction'] = 'Gallery images can be aligned horizontally or vertically.'; +$helptxt['sp_param_sp_arcade_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_arcade_type'] = 'Displays the arcades most played games, best players, or longest champions.'; +$helptxt['sp_param_sp_shop_style'] = 'Displays the richest members or shop items.'; +$helptxt['sp_param_sp_shop_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_shop_type'] = 'Displays the members total money, pocketed money, or money in the bank.'; +$helptxt['sp_param_sp_shop_sort'] = 'Displays random or recently added items.'; +$helptxt['sp_param_sp_blog_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_blog_type'] = 'Displays articles or blogs.'; +$helptxt['sp_param_sp_blog_sort'] = 'Displays blogs randomly or by the latest blogs updated.'; +$helptxt['sp_param_sp_html_content'] = 'Enter the custom HTML content in this box.'; +$helptxt['sp_param_sp_bbc_content'] = 'Enter the custom BBC content in this box.'; +$helptxt['sp_param_sp_php_content'] = 'Enter the custom PHP content in this box.'; + +?> \ No newline at end of file diff --git a/Themes/default/languages/SPortalHelp.english.php b/Themes/default/languages/SPortalHelp.english.php new file mode 100644 index 0000000..eb6a22c --- /dev/null +++ b/Themes/default/languages/SPortalHelp.english.php @@ -0,0 +1,174 @@ +
+Disabled: This will completely disable the portal.

+Frontpage: This is the default setting. The portal page will greet viewers instead of the board index. Members will be able to access the board index by using the "forum" action, which can be accessed through the "forum" button.

+Integration: This will disable the portal page. Blocks are only usable in forum.

+Standalone: This will enable the portal to be displayed at a different url, away from the forum. The portal page appears in the url defined for the "Standalone URL" option. For details, check the PortalStandalone.php file found inside the forum root.'; +$helptxt['sp_maintenance'] = 'When maintenance is enabled, portal is only visible by members with Moderate SimplePortal permission.'; +$helptxt['sp_standalone_url'] = 'Full URL to the standalone file.

Example: http://myforum.com/portal.php'; +$helptxt['portaltheme'] = 'Select the theme which will be used for the portal.'; +$helptxt['sp_disableForumRedirect'] = 'If this box is unchecked, users will be redirected to the portal after they login or logout. If this box is checked, then users will be redirected to the BoardIndex.'; +$helptxt['sp_disableColor'] = 'If the Member Color Link mod is installed, this will disable the mod on the portal (except in the who\'s online list).'; +$helptxt['sp_disable_random_bullets'] = 'Disables random coloring for bullet images used in portal lists.'; +$helptxt['sp_disable_php_validation'] = 'Disables validation of PHP block codes, which is to prevent syntax and database errors in code.'; +$helptxt['sp_disable_side_collapse'] = 'Disables ability to collapse the left and right sides of the portal.'; +$helptxt['sp_resize_images'] = 'Enables resizing images in articles and board news to 300x300px, to prevent possible overflows.'; + +// Block settings +$helptxt['showleft'] = 'This will enable left side blocks on the portal and inside the forum.'; +$helptxt['showright'] = 'This will enable right side blocks on the portal and inside the forum.'; +$helptxt['leftwidth'] = 'If left side blocks are enabled, their width can be specified here. The width can be specified in pixels (px) or in percentages (%).'; +$helptxt['rightwidth'] = 'If right side blocks are enabled, their width can be specified here. The width can be specified in pixels (px) or in percentages (%).'; +$helptxt['sp_enableIntegration'] = 'This setting enables blocks inside the forum. It allows the advanced Display Options for each block to be specified.'; +$helptxt['sp_IntegrationHide'] = 'Hide blocks in certain forum sections. The Display blocks in Forum setting must be enabled for this to work.'; + +// Article settings +$helptxt['articleactive'] = 'This setting enables articles to be displayed on the portal.'; +$helptxt['articleperpage'] = 'This sets the maximum amount of articles shown per page.'; +$helptxt['articlelength'] = 'This setting allows a limit to be set on the amount of characters an article can display on the portal page. If the article exceeds this limit it will be shortened and have an ellipsis (...) link on the end, which allows the user to view the entire article.'; +$helptxt['articleavatar'] = 'If this setting is enabled the authors avatar will be shown along with each article.'; + +// Blocks area +$helptxt['sp_BlocksArea'] = 'Blocks are boxes which can be displayed on the portal or inside the forum. This section enables existing blocks to be modified, and new ones to be created.'; + +// Block list +$helptxt['sp-blocksLeftList'] = 'These blocks are displayed on the left side of the portal and forum.'; +$helptxt['sp-blocksTopList'] = 'These blocks are centered at the top of the portal and forum.'; +$helptxt['sp-blocksBottomList'] = 'These blocks are centered at the bottom of the portal and forum.'; +$helptxt['sp-blocksRightList'] = 'These blocks are displayed on the right side of the portal and forum.'; +$helptxt['sp-blocksHeaderList'] = 'These blocks are displayed on the top of the portal and forum.'; +$helptxt['sp-blocksFooterList'] = 'These blocks are displayed on the bottom of the portal and forum.'; + +// Add/Edit blocks +$helptxt['sp-blocksAdd'] = 'This area enables the selected block to be customised and configured.'; +$helptxt['sp-blocksSelectType'] = 'This area enables blocks to be created for the portal page. Pre-built blocks or custom content blocks can be created easily by selecting the appropriate options.'; +$helptxt['sp-blocksEdit'] = 'This area enables the selected block to be customised and configured.'; +$helptxt['sp-blocksDisplayOptions'] = 'This area allows you to select on which pages block will appear.'; +$helptxt['sp-blocksCustomDisplayOptions'] = 'Custom display options allows a more advanced control over where to display the block with its special syntax.

+Special actions include:

+all: every page in forum.
+portal: portal page and it\'s sub-actions.
+forum: board index.
+sforum: all actions and boards, except portal.
+allaction: all actions.
+allboard: all boards.

+Wavy (~)
+This symbol acts as a wildcard, allowing you to include dynamic actions like ../index.php?issue=* or ../index.php?game=*. Used as ~action

+Idkin (|)
+Another wildcard sybmol which allows you to specify an exact value for a dynamic action like ../index.php?issue=1.0 or ../index.php?game=xyz. Should be used with wavy and after the action like; ~action|value

+Negator (-)
+This symbol is to exclude regular and dynamic actions. Should be used before the action name for regular actions and before the wavy for dynamic actions. Used as -action and -~action'; +$helptxt['sp-blocksStyleOptions'] = 'These options allow you to specify CSS styling for each blocks.'; + +// Articles area +$helptxt['sp_ArticlesArea'] = 'Articles are topics (first post only) which are displayed on the portal. This section enables existing articles to be modified, and new ones to be created for the portal.'; + +// Add/Edit articles +$helptxt['sp-articlesAdd'] = 'This area allows you to add articles to categories from your boards.'; +$helptxt['sp-articlesEdit'] = 'In this area you change the category or status of the articles.'; +$helptxt['sp-articlesCategory'] = 'Select a category for this article.'; +$helptxt['sp-articlesApproved'] = 'Approved articles will appear on the portal articles area.'; +$helptxt['sp-articlesTopics'] = 'Select the topics to be displayed as articles on the portal.'; +$helptxt['sp-articlesBoards'] = 'Select a board to search for topics.'; + +// Categories area +$helptxt['sp_CategoriesArea'] = 'Categories hold articles. This section enables existing categories to be modified, and new ones to be created for articles. To create an article there must be at least one category.'; + +// Add/Edit categories +$helptxt['sp-categoriesAdd'] = 'This section enables categories to be created for articles. To create articles there must be at least one category.'; +$helptxt['sp-categoriesEdit'] = 'This section enables categories to be modified.'; +$helptxt['sp-categoriesCategories'] = 'This page displays a list of the current article categories. To create articles there must be at least one category.'; +$helptxt['sp-categoriesDelete'] = 'Deleting a category will either delete the articles in it, or move them to another category.'; + +// Pages area +$helptxt['sp_PagesArea'] = 'Pages are BBC, PHP or HTML code blocks that are shown on their own page within your forum. This section allows you to create, edit and configure your pages.'; + +// Shoutbox area +$helptxt['sp_ShoutboxArea'] = 'Shoutboxes need to be created in this section. This section allows shoutboxes to be created and configured. A shoutbox block will then need to be used to show the shoutbox that is created.'; + +// Add/Edit shoutboxes +$helptxt['sp-shoutboxesWarning'] = 'The warning message that you set here will be shown in the shoutbox, anyone using the shoutbox will see this message.'; +$helptxt['sp-shoutboxesBBC'] = 'This setting allows you to choose the BBC that can be used in this shoutbox.

Hold down the CTRL key to select or deselect a particular BBC.

If you want to select a series of consecutive BBC, then click on the first BBC that you want to select, hold down the SHIFT key, then click on the last BBC that you want to select.'; + +$helptxt['sp_permissions'] = 'This option enables permissions to be used on blocks. The first three options are the simplest to use and understand. +
    +
  • Guests: Any user who is not registered or logged in will see this block. Logged-in users (including Administrators) will not see this block.
  • +
  • Members: Any user who is logged in (including Administrators) will see this block.
  • +
  • Everyone: All users, whether they are logged in or not, will see this block.
  • +
  • Custom: Select this to show the Custom Permissions area. In the Custom Permissions Settings, there are three options to choose for each group. +
      +
    • A: Allowed, any user of this group will see this block.
    • +
    • X: Disallowed, any user of this group will not see this block by default. The user may see this block if they are part of a group with Allowed permissions.
    • +
    • D: Denied, any user of this group will never see this block. This overrides the Allowed setting for any group a user is part of, so be careful with this permission.
    • +
    +
  • +
'; + +// Block parameters +$helptxt['sp_param_sp_latestMember_limit'] = 'How many members to display.'; +$helptxt['sp_param_sp_boardStats_averages'] = 'Display average statistics.'; +$helptxt['sp_param_sp_topPoster_limit'] = 'How many top posters to display.'; +$helptxt['sp_param_sp_topPoster_type'] = 'Time period to show top posters from.'; +$helptxt['sp_param_sp_recent_limit'] = 'How many recent posts or topics to display.'; +$helptxt['sp_param_sp_recent_type'] = 'Display recent posts or topics.'; +$helptxt['sp_param_sp_recentPosts_limit'] = 'How many recent posts to display.'; +$helptxt['sp_param_sp_recentTopics_limit'] = 'How many recent topics to display.'; +$helptxt['sp_param_sp_topTopics_type'] = 'Sort topics by replies or views.'; +$helptxt['sp_param_sp_topTopics_limit'] = 'How many topics to display.'; +$helptxt['sp_param_sp_topBoards_limit'] = 'How many boards to display.'; +$helptxt['sp_param_sp_showPoll_topic'] = 'The ID of the topic containing the poll to be displayed.'; +$helptxt['sp_param_sp_showPoll_type'] = 'Select the way polls should be displayed. Normal enables a specific poll to be called by the topic ID, Recent displays the most recently posted poll, and random displays a random poll.'; +$helptxt['sp_param_sp_boardNews_board'] = 'The ID of the board where the topics come from. Leave empty to fetch topics from all visible boards.'; +$helptxt['sp_param_sp_boardNews_limit'] = 'The maximum number of news items to be displayed.'; +$helptxt['sp_param_sp_boardNews_start'] = 'The ID of a particular post to start with (otherwise the first result will be used).'; +$helptxt['sp_param_sp_boardNews_length'] = 'If specified, posts exceeding this limit will be shortened and have an ellipsis (...), or a "Read More" link placed on the end.'; +$helptxt['sp_param_sp_boardNews_avatar'] = 'Enables avatars to be displayed for the member who posted the board news.'; +$helptxt['sp_param_sp_boardNews_per_page'] = 'How many posts to display per page. Leave empty to disable pagination.'; +$helptxt['sp_param_sp_attachmentImage_limit'] = 'How many recently attached images to display.'; +$helptxt['sp_param_sp_attachmentImage_direction'] = 'Attachment images can be aligned horizontally or vertically.'; +$helptxt['sp_param_sp_attachmentRecent_limit'] = 'How many recent attachments to display.'; +$helptxt['sp_param_sp_calendar_events'] = 'Enables events from the calendar to be displayed.'; +$helptxt['sp_param_sp_calendar_birthdays'] = 'Displays birthdays from the calendar.'; +$helptxt['sp_param_sp_calendar_holidays'] = 'Displays holidays from the calendar.'; +$helptxt['sp_param_sp_calendarInformation_events'] = 'Enables events from the calendar to be displayed.'; +$helptxt['sp_param_sp_calendarInformation_future'] = 'Allows you to choose the number of days into the future from which upcoming calendar events will be shown. This requires the ability to display events from the calendar. To display only events for today, use "0".'; +$helptxt['sp_param_sp_calendarInformation_birthdays'] = 'Displays birthdays from the calendar.'; +$helptxt['sp_param_sp_calendarInformation_holidays'] = 'Displays holidays from the calendar.'; +$helptxt['sp_param_sp_rssFeed_url'] = 'Enter the full URL of the RSS feed.'; +$helptxt['sp_param_sp_rssFeed_show_title'] = 'Show feed titles.'; +$helptxt['sp_param_sp_rssFeed_show_content'] = 'Show feed contents.'; +$helptxt['sp_param_sp_rssFeed_show_date'] = 'Show feed dates.'; +$helptxt['sp_param_sp_rssFeed_strip_preserve'] = 'HTML tags to preserve in feed content separated by commas.'; +$helptxt['sp_param_sp_rssFeed_count'] = 'How many items to display.'; +$helptxt['sp_param_sp_rssFeed_limit'] = 'How many characters to display from the RSS feeds content.'; +$helptxt['sp_param_sp_staff_lmod'] = 'Disables Local Moderators from being listed.'; +$helptxt['sp_param_sp_articles_category'] = 'The category to display articles from.'; +$helptxt['sp_param_sp_articles_limit'] = 'How many articles to display.'; +$helptxt['sp_param_sp_articles_type'] = 'Displays random articles, or the latest articles.'; +$helptxt['sp_param_sp_articles_image'] = 'Enables a category image, avatar, or nothing to be displayed on the article.'; +$helptxt['sp_param_sp_gallery_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_gallery_type'] = 'Displays random or the latest gallery items.'; +$helptxt['sp_param_sp_gallery_direction'] = 'Gallery images can be aligned horizontally or vertically.'; +$helptxt['sp_param_sp_arcade_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_arcade_type'] = 'Displays the arcades most played games, best players, or longest champions.'; +$helptxt['sp_param_sp_shop_style'] = 'Displays the richest members or shop items.'; +$helptxt['sp_param_sp_shop_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_shop_type'] = 'Displays the members total money, pocketed money, or money in the bank.'; +$helptxt['sp_param_sp_shop_sort'] = 'Displays random or recently added items.'; +$helptxt['sp_param_sp_blog_limit'] = 'How many items to display.'; +$helptxt['sp_param_sp_blog_type'] = 'Displays articles or blogs.'; +$helptxt['sp_param_sp_blog_sort'] = 'Displays blogs randomly or by the latest blogs updated.'; +$helptxt['sp_param_sp_html_content'] = 'Enter the custom HTML content in this box.'; +$helptxt['sp_param_sp_bbc_content'] = 'Enter the custom BBC content in this box.'; +$helptxt['sp_param_sp_php_content'] = 'Enter the custom PHP content in this box.'; + +?> \ No newline at end of file diff --git a/Themes/default/scripts/portal.js b/Themes/default/scripts/portal.js new file mode 100644 index 0000000..abeb651 --- /dev/null +++ b/Themes/default/scripts/portal.js @@ -0,0 +1,239 @@ +// Version 2.3.5; portal.js + +// Define the version of SMF that we are using. +if (typeof(smf_editorArray) == "undefined") + portal_smf_version = 1.1; +else + portal_smf_version = 2; + +function sp_collapse_object(id, has_image) +{ + mode = document.getElementById("sp_object_" + id).style.display == '' ? 0 : 1; + document.getElementById("sp_object_" + id).style.display = mode ? '' : 'none'; + + if (typeof(has_image) == "undefined" || has_image == true) + document.getElementById("sp_collapse_" + id).src = smf_images_url + (mode ? '/collapse.gif' : '/expand.gif'); +} + +function sp_image_resize() +{ + var possible_images = document.getElementsByTagName("img"); + for (var i = 0; i < possible_images.length; i++) + { + if (possible_images[i].className != (portal_smf_version == 1.1 ? "sp_article" : "bbc_img sp_article")) + continue; + + var temp_image = new Image(); + temp_image.src = possible_images[i].src; + + if (temp_image.width > 300) + { + possible_images[i].height = (300 * temp_image.height) / temp_image.width; + possible_images[i].width = 300; + } + else + { + possible_images[i].width = temp_image.width; + possible_images[i].height = temp_image.height; + } + } + + if (typeof(window_oldSPImageOnload) != "undefined" && window_oldSPImageOnload) + { + window_oldSPImageOnload(); + window_oldSPImageOnload = null; + } +} + +function sp_submit_shout(shoutbox_id, sSessionVar, sSessionId) +{ + if (window.XMLHttpRequest) + { + shoutbox_indicator(shoutbox_id, true); + + var shout_body = ""; + + if (portal_smf_version == 1.1) + shout_body = escape(textToEntities(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B"); + else + shout_body = escape(document.getElementById('new_shout_' + shoutbox_id).value.replace(/&#/g, "&#").php_to8bit()).replace(/\+/g, "%2B"); + + sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + 'action=portal;sa=shoutbox;xml', 'shoutbox_id=' + shoutbox_id + '&shout=' + shout_body + '&' + sSessionVar + '=' + sSessionId, onShoutReceived); + + document.getElementById('new_shout_' + shoutbox_id).value = ''; + + return false; + } +} + +function sp_delete_shout(shoutbox_id, shout_id, sSessionVar, sSessionId) +{ + if (window.XMLHttpRequest) + { + shoutbox_indicator(shoutbox_id, true); + + sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + 'action=portal;sa=shoutbox;xml', 'shoutbox_id=' + shoutbox_id + '&delete=' + shout_id + '&' + sSessionVar + '=' + sSessionId, onShoutReceived); + + return false; + } +} + +function sp_refresh_shout(shoutbox_id, last_refresh) +{ + if (window.XMLHttpRequest) + { + shoutbox_indicator(shoutbox_id, true); + + getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + 'action=portal;sa=shoutbox;shoutbox_id=' + shoutbox_id + ';time=' + last_refresh + ';xml', onShoutReceived); + + return false; + } +} + +// Function to handle the receiving of new shout data from the xml request. +function onShoutReceived(XMLDoc) +{ + var shouts = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shout"); + var shoutbox_id, updated, error, warning, reverse, shout, id, author, time, timeclean, delete_link, content, is_me, new_body = ''; + + shoutbox_id = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shoutbox")[0].childNodes[0].nodeValue; + updated = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("updated")[0].childNodes[0].nodeValue; + + if (updated == 1) + { + error = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("error")[0].childNodes[0].nodeValue; + warning = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("warning")[0].childNodes[0].nodeValue; + reverse = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("reverse")[0].childNodes[0].nodeValue; + + if (warning != 0) + new_body += '
  • ' + warning + '
  • '; + + if (error != 0) + setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body + '
  • ' + error + '
  • '); + else + { + for (var i = 0; i < shouts.length; i++) + { + shout = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("shout")[i]; + id = shout.getElementsByTagName("id")[0].childNodes[0].nodeValue; + author = shout.getElementsByTagName("author")[0].childNodes[0].nodeValue; + time = shout.getElementsByTagName("time")[0].childNodes[0].nodeValue; + timeclean = shout.getElementsByTagName("timeclean")[0].childNodes[0].nodeValue; + delete_link = shout.getElementsByTagName("delete")[0].childNodes[0].nodeValue; + content = shout.getElementsByTagName("content")[0].childNodes[0].nodeValue; + is_me = shout.getElementsByTagName("is_me")[0].childNodes[0].nodeValue; + + new_body += '
  • ' + (is_me == 0 ? '' + author + ': ' : '') + content + '
    ' + (delete_link != 0 ? ('' + delete_link + '') : '') + '' + time + '
  • '; + } + + setInnerHTML(document.getElementById('shouts_' + shoutbox_id), new_body); + + if (reverse != 0) + document.getElementById('shouts_' + shoutbox_id).scrollTop = document.getElementById('shouts_' + shoutbox_id).scrollHeight; + else + document.getElementById('shouts_' + shoutbox_id).scrollTop = 0; + + var sp_date = new Date; + eval("last_refresh_" + shoutbox_id + " = " + Math.round(sp_date.getTime() / 1000, 0) + ";"); + } + } + + shoutbox_indicator(shoutbox_id, false); + + return false; +} + +function shoutbox_indicator(shoutbox_id, turn_on) +{ + document.getElementById('shoutbox_load_' + shoutbox_id).style.display = turn_on ? '' : 'none'; +} + +function sp_catch_enter(key) +{ + var keycode; + + if (window.event) + keycode = window.event.keyCode; + else if (key) + keycode = key.which; + + if (keycode == 13) + return true; +} + +function sp_show_ignored_shout(shout_id) +{ + document.getElementById('ignored_shout_' + shout_id).style.display = ''; + document.getElementById('ignored_shout_link_' + shout_id).style.display = 'none'; +} + +function sp_show_history_ignored_shout(shout_id) +{ + document.getElementById('history_ignored_shout_' + shout_id).style.display = ''; + document.getElementById('history_ignored_shout_link_' + shout_id).style.display = 'none'; +} + +function style_highlight(something, mode) +{ + something.style.backgroundImage = 'url(' + smf_images_url + (mode ? '/bbc/bbc_hoverbg.gif)' : '/bbc/bbc_bg.gif)'); +} + +function smf_prepareScriptUrl(sUrl) +{ + return sUrl.indexOf('?') == -1 ? sUrl + '?' : sUrl + (sUrl.charAt(sUrl.length - 1) == '?' || sUrl.charAt(sUrl.length - 1) == '&' || sUrl.charAt(sUrl.length - 1) == ';' ? '' : ';'); +} + +// This function is for SMF 1.1.x as well as SMF 2RC1.2 and below. +function sp_compat_showMoreSmileys(postbox, sTitleText, sPickText, sCloseText, smf_theme_url, smf_smileys_url) +{ + if (this.oSmileyPopupWindow) + this.oSmileyPopupWindow.close(); + + this.oSmileyPopupWindow = window.open('', 'add_smileys', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes'); + this.oSmileyPopupWindow.document.write('\n'); + this.oSmileyPopupWindow.document.write('\n\t\n\t\t' + sTitleText + '\n\t\t\n\t'); + this.oSmileyPopupWindow.document.write('\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t
    ' + sPickText + '
    '); + + for (i = 0; i < sp_smileys.length; i++) + { + sp_smileys[i][2] = sp_smileys[i][2].replace(/"/g, '"'); + sp_smileys[i][0] = sp_smileys[i][0].replace(/"/g, '"'); + this.oSmileyPopupWindow.document.write('' + sp_smileys[i][2] + ' '); + } + + this.oSmileyPopupWindow.document.write('
    ' + sCloseText + '
    '); + this.oSmileyPopupWindow.document.write('\n\t\n'); + this.oSmileyPopupWindow.document.close(); +} + +// This function is for SMF 2 RC2 and above. +function sp_showMoreSmileys(postbox, sTitleText, sPickText, sCloseText, smf_theme_url, smf_smileys_url) +{ + if (this.oSmileyPopupWindow != null && 'closed' in this.oSmileyPopupWindow && !this.oSmileyPopupWindow.closed) + { + this.oSmileyPopupWindow.focus(); + return; + } + + if (sp_smileyRowsContent == undefined) + { + var sp_smileyRowsContent = ''; + for (i = 0; i < sp_smileys.length; i++) + { + sp_smileys[i][2] = sp_smileys[i][2].replace(/"/g, '"'); + sp_smileys[i][0] = sp_smileys[i][0].replace(/"/g, '"'); + sp_smileyRowsContent += '' + sp_smileys[i][2] + ' '; + } + + } + + this.oSmileyPopupWindow = window.open('', 'add_smileys', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes'); + + // Paste the template in the popup. + this.oSmileyPopupWindow.document.open('text/html', 'replace'); + this.oSmileyPopupWindow.document.write(sp_moreSmileysTemplate.easyReplace({ + smileyRows: sp_smileyRowsContent + })); + + this.oSmileyPopupWindow.document.close(); +} \ No newline at end of file diff --git a/Themes/default/scripts/script.js b/Themes/default/scripts/script.js index e301940..f6a08d2 100644 --- a/Themes/default/scripts/script.js +++ b/Themes/default/scripts/script.js @@ -1070,7 +1070,7 @@ JumpTo.prototype.fillSelect = function (aBoardsAndCategories) oOption = document.createElement('option'); oOption.appendChild(document.createTextNode((aBoardsAndCategories[i].isCategory ? this.opt.sCatPrefix : sChildLevelPrefix + this.opt.sBoardPrefix) + aBoardsAndCategories[i].name)); - oOption.value = aBoardsAndCategories[i].isCategory ? '#c' + aBoardsAndCategories[i].id : '?board=' + aBoardsAndCategories[i].id + '.0'; + oOption.value = aBoardsAndCategories[i].isCategory ? '?action=forum#c' + aBoardsAndCategories[i].id : '?board=' + aBoardsAndCategories[i].id + '.0'; oListFragment.appendChild(oOption); if (aBoardsAndCategories[i].isCategory) diff --git a/index.php b/index.php index 3d123ed..0fa28a9 100644 --- a/index.php +++ b/index.php @@ -54,6 +54,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) @@ -205,11 +206,18 @@ function smf_main() // Log this user as online. writeLog(); - // Track forum statistics and hits...? - if (!empty($modSettings['hitStats'])) - trackStats(array('hits' => '+')); + // Don't track stats of portal xml actions. + if (empty($_REQUEST['action']) || $_REQUEST['action'] != 'portal' || !isset($_GET['xml'])) + { + // Track forum statistics and hits...? + if (!empty($modSettings['hitStats'])) + trackStats(array('hits' => '+')); + } } + // Load SimplePortal. + sportal_init(); + // Is the forum in maintenance mode? (doesn't apply to administrators.) if (!empty($maintenance) && !allowedTo('admin_forum')) { @@ -234,6 +242,11 @@ function smf_main() } elseif (empty($_REQUEST['action'])) { + // Go catch it boy! Catch it! + $sp_action = sportal_catch_action(); + if ($sp_action) + return $sp_action; + // Action and board are both empty... BoardIndex! if (empty($board) && empty($topic)) { @@ -273,6 +286,8 @@ function smf_main() 'editpoll2' => array('Poll.php', 'EditPoll2'), 'emailuser' => array('SendTopic.php', 'EmailUser'), 'findmember' => array('Subs-Auth.php', 'JSMembers'), + 'forum' => array('BoardIndex.php', 'BoardIndex'), + 'portal' => array('PortalMain.php', 'sportal_main'), 'groups' => array('Groups.php', 'Groups'), 'help' => array('Help.php', 'ShowHelp'), 'helpadmin' => array('Help.php', 'ShowAdminHelp'), @@ -341,6 +356,9 @@ function smf_main() // Allow modifying $actionArray easily. call_integration_hook('integrate_actions', array(&$actionArray)); + if (!empty($context['disable_sp'])) + unset($actionArray['portal'], $actionArray['forum']); + // Get the function and file to include - if it's not there, do the board index. if (!isset($_REQUEST['action']) || !isset($actionArray[$_REQUEST['action']])) {