Example #1
0
function view()
{
    global $context, $txt;
    //Load main trader template.
    $context['sub_template'] = 'view';
    //Set the page title
    $context['page_title'] = $txt['adkadmin_name'] . ': ' . $txt['adkadmin_news'];
    $context['adkportal']['current_version'] = getCurrentversion();
    $context['adkportal']['your_version'] = getYourversion();
    if ($context['adkportal']['your_version'] == $context['adkportal']['current_version']) {
        $context['adkportal']['style_version'] = '<b style="color: green;">' . $context['adkportal']['your_version'] . '</b><br /><hr />';
    } else {
        $context['adkportal']['style_version'] = '<b style="color: red;">' . $context['adkportal']['current_version'] . '</b><br /><hr /><div align="center"><a href="http://www.smfpersonal.net/index.php?action=downloads;cat=1" target="_blank"><strong>' . $txt['adkadmin_download_now'] . '</strong></a></div>';
    }
}
function Adk_portal_change_buffer(&$buffer)
{
    global $adkportal, $boardurl, $scripturl, $settings, $forum_copyright, $context, $txt, $current_load;
    //Set the Copyright for different pages
    //Replace here to create your copyright with the action=
    $copyrights = array('downloads' => 'Extreme download system by Adk Portal', 'contact' => 'Contact module by Adk Portal', 'pages' => 'Pages module by Adk Portal', 'adk_shoutbox' => 'Shoutbox by Adk portal');
    //Set the copyrights :)
    call_integration_hook('modules_copyright', array(&$copyrights));
    if ($current_load[0] == 'action' && !empty($copyrights[$current_load[1]])) {
        $buffer = str_replace($forum_copyright, $forum_copyright . '<br /><a href="http://www.softpersonal.com" target="_blank">' . $copyrights[$current_load[1]] . '</a>', $buffer);
    } elseif ($current_load[0] == 'page') {
        $buffer = str_replace($forum_copyright, $forum_copyright . '<br /><a href="http://www.softpersonal.com" target="_blank">' . $copyrights['pages'] . '</a>', $buffer);
    }
    //Seo pages
    if (!empty($adkportal['enable_pages_seo'])) {
        $buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\\?page=([^#"]+?)?"~', 'preg_page', $buffer);
    }
    //Replace images url from admin
    $buffer = str_replace($settings['images_url'] . '/admin', $settings['default_images_url'] . '/admin', $buffer);
    //Set another things
    $load = $adkportal['variables_important'];
    if (empty($load)) {
        $version = getYourversion();
        $load = $adkportal['copy'];
    }
    $buffer = str_replace($forum_copyright, $forum_copyright . $load, $buffer);
    if (!empty($context['adk_stand_alone'])) {
        $re_new = $load . $load;
        $buffer = str_replace($re_new, $load, $buffer);
    }
    if (!empty($adkportal['enable_download_seo'])) {
        $buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\\?action=downloads;cat=([^#"]+?);([^#"]+?)?"~', 'preg_down', $buffer);
        $buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\\?action=downloads;cat=([^#"]+?)?"~', 'preg_down2', $buffer);
        $buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\\?action=downloads;sa=view;down=([^#"]+?)?"~', 'preg_down3', $buffer);
    }
    //Rewrite cat url's
    if ($adkportal['adk_enable'] == 1) {
        $buffer = preg_replace_callback('~"' . preg_quote($scripturl, '/') . '\\#c([^#"]+?)"~', 'preg_forum', $buffer);
    }
    //Let's modify SMF Profile.php
    if (!empty($adkportal['enable_pages_comments']) && !empty($adkportal['enable_pages_notifications']) && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'profile' && !empty($_REQUEST['area']) && $_REQUEST['area'] == 'theme') {
        $buffer = str_replace('<ul id="theme_settings">', '<ul id="theme_settings">
				<li>
					<input type="hidden" name="default_options[adk_disable_notifications_profile]" value="0" />
					<label for="adk_disable_notifications_profile"><input type="checkbox" name="default_options[adk_disable_notifications_profile]" id="adk_disable_notifications_profile" value="1"' . (!empty($context['member']['options']['adk_disable_notifications_profile']) ? ' checked="checked"' : '') . ' class="input_check" /> ' . $txt['adk_disable_notifications_profile'] . '</label>
				</li>', $buffer);
    }
    return $buffer;
}