function ViewInactive()
{
    global $context, $scripturl, $txt, $settings, $smcFunc, $ultimateportalSettings, $user_info;
    if (empty($ultimateportalSettings['ipage_enable'])) {
        fatal_lang_error('ultport_error_no_active', false);
    }
    $id = !empty($_REQUEST['id']) ? (int) $smcFunc['db_escape_string']($_REQUEST['id']) : '';
    if (empty($id)) {
        fatal_lang_error('ultport_error_no_action', false);
    }
    //Load Specific Internal Page
    LoadInternalPage($id, "WHERE active = 'off'");
    //Can VIEW?, disabled page?, is admin?
    if ((empty($context['view_ipage']) || $context['can_view'] === false) && !$user_info['is_admin']) {
        fatal_lang_error('ultport_error_no_view', false);
    }
    //IP Link-tree
    $context['news-linktree'] = '&nbsp;<img alt="" border="0" src="' . $settings['default_images_url'] . '/ultimate-portal/open_linktree.gif" />&nbsp;<a href="' . $scripturl . '?action=internal-page">' . $txt['up_module_ipage_title'] . '</a> <br /><img alt="" border="0" src="' . $settings['default_images_url'] . '/ultimate-portal/linktree_side.gif" />&nbsp;' . $context['title'];
    $context['linktree'][1] = array('url' => $scripturl . '?action=internal-page', 'name' => $txt['up_module_ipage_title']);
    //Social Bookmarks
    $context['social_bookmarks'] = !empty($ultimateportalSettings['ipage_social_bookmarks']) ? UpSocialBookmarks($scripturl . '?action=internal-page;sa=view;id=' . $id) : '';
    $context['sub_template'] = 'view';
    $context['page_title'] = $txt['up_module_ipage_title'] . ' - ' . $context['title'];
}
Example #2
0
function ViewNew()
{
    global $db_prefix, $context, $scripturl, $txt, $settings;
    global $smcFunc;
    $id = $smcFunc['db_escape_string']($_REQUEST['id']);
    $id = (int) $id;
    //Load the NEWS
    $myquery2 = $smcFunc['db_query']('', "SELECT *\n\t\t\t\t\t\tFROM {$db_prefix}up_news\n\t\t\t\t\t\tWHERE id = {$id}\n\t\t\t\t\t\tORDER BY id DESC");
    while ($row2 = $smcFunc['db_fetch_assoc']($myquery2)) {
        $context['id_cat'] = $row2['id_category'];
        //display the news for this category? and no log errors if this context is "0"
        $context['display-news'] = !empty($row2['id']) ? 1 : 0;
        //end
        $news =& $context['news'][];
        $news['id'] = $row2['id'];
        $news['title'] = '<a href="' . $scripturl . '?action=news;sa=view-new;id=' . $row2['id'] . '">' . stripslashes($row2['title']) . '</a>';
        $context['title_news'] = $news['title'];
        $context['page-title-news'] = $row2['title'];
        $news['id_member'] = $row2['id_member'];
        //load the member information
        if (!empty($row2['id_member'])) {
            loadMemberData($news['id_member']);
            loadMemberContext($news['id_member']);
        }
        $news['username'] = $row2['username'];
        $news['author'] = '<a href="' . $scripturl . '?action=profile;u=' . $row2['id_member'] . '">' . stripslashes($row2['username']) . '</a>';
        $news['date'] = timeformat($row2['date']);
        $news['added-news'] = $txt['up_module_news_added_portal_for'];
        $news['added-news'] = str_replace('[MEMBER]', $news['author'], $news['added-news']);
        $news['added-news'] = str_replace('[DATE]', $news['date'], $news['added-news']);
        $news['body'] = stripslashes($row2['body']);
        $news['id_member_updated'] = !empty($row2['id_member_updated']) ? $row2['id_member_updated'] : '';
        $news['username_updated'] = !empty($row2['username_updated']) ? $row2['username_updated'] : '';
        $news['author_updated'] = '<a href="' . $scripturl . '?action=profile;u=' . $row2['id_member_updated'] . '">' . stripslashes($row2['username_updated']) . '</a>';
        $news['date_updated'] = !empty($row2['date_updated']) ? timeformat($row2['date_updated']) : '';
        $news['updated-news'] = !empty($news['id_member_updated']) ? $txt['up_module_news_updated_for'] : '';
        $news['updated-news'] = str_replace('[UPDATED_MEMBER]', $news['author_updated'], $news['updated-news']);
        $news['updated-news'] = str_replace('[UPDATED_DATE]', $news['date_updated'], $news['updated-news']);
        $news['view'] = '<img alt="' . $txt['ultport_button_view'] . '" border="0" src="' . $settings['default_images_url'] . '/ultimate-portal/view.png" />&nbsp;<a href="' . $scripturl . '?action=news;sa=view-new;id=' . $row2['id'] . '">' . $txt['ultport_button_view'] . '</a>';
        $news['edit'] = '<img border="0" src="' . $settings['default_images_url'] . '/ultimate-portal/edit.png" alt="" />&nbsp;<a href="' . $scripturl . '?action=news;sa=edit-new;id=' . $row2['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['ultport_button_edit'] . '</a>';
        $news['delete'] = '<img border="0" src="' . $settings['default_images_url'] . '/ultimate-portal/delete.png" alt="" />&nbsp;<a onclick="return makesurelink()" href="' . $scripturl . '?action=news;sa=delete-new;id=' . $row2['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . $txt['ultport_button_delete'] . '</a>';
    }
    //Load the section
    $myquery = $smcFunc['db_query']('', "SELECT id, title, icon \n\t\t\t\t\t\tFROM {$db_prefix}up_news_sections \n\t\t\t\t\t\tWHERE id = " . $context['id_cat'] . "");
    while ($row = $smcFunc['db_fetch_assoc']($myquery)) {
        $context['id'] = $row['id'];
        $context['title'] = stripslashes($row['title']);
        $context['title2'] = '<a href="' . $scripturl . '?action=news;sa=show-cat;id=' . $row['id'] . '">' . stripslashes($row['title']) . '</a>';
        $context['icon'] = '<img alt="' . $row['title'] . '" src="' . $row['icon'] . '" width="35" height="35"/>';
    }
    //News Link-tree
    $context['news-linktree'] = '&nbsp;<img alt="' . $txt['up_module_news_title'] . '" border="0" src="' . $settings['default_images_url'] . '/ultimate-portal/open_linktree.gif" />&nbsp;<a href="' . $scripturl . '?action=news">' . $txt['up_module_news_title'] . '</a> &raquo; ' . $context['title2'] . '<br /><img border="0" src="' . $settings['default_images_url'] . '/ultimate-portal/linktree_side.gif" alt="" />&nbsp;' . $context['title_news'];
    //Forum linktree
    $context['linktree'][1] = array('url' => $scripturl . '?action=news', 'name' => $txt['up_module_news_title']);
    //Social Bookmarks
    $context['social_bookmarks'] = UpSocialBookmarks($scripturl . '?action=news;sa=view-new;id=' . $id);
    // Call the sub template.
    $context['sub_template'] = 'view_news';
    $context['page_title'] = $txt['up_module_news_title'] . ' - ' . $context['title'] . ' - ' . $context['page-title-news'];
}