Пример #1
0
function adk_shoutbox()
{
    global $boardurl, $txt, $adkportal, $context, $user_info, $boarddir, $boardurl, $scripturl, $modSettings, $settings, $adkFolder;
    if ($context['user']['is_logged']) {
        $vershout = 1;
    } elseif ($context['user']['is_guest'] && !empty($adkportal['adk_guest_view_post']) && empty($modSettings['allow_guestAccess'])) {
        $vershout = 0;
    } elseif ($context['user']['is_guest'] && !empty($modSettings['allow_guestAccess'])) {
        $vershout = 1;
    }
    if (!empty($context['block']['b'])) {
        echo '
			<span class="clear upperframe">
				<span>&nbsp;</span>	
			</span>
			<div class="roundframe">
				<div>';
    }
    if (empty($vershout)) {
        echo '<div class="smalltetext">' . $txt['adkmod_block_shout_now_allowed'] . '</div>';
    } else {
        //Post action? not show this block... for security reasons
        if (!empty($context['post_box_name'])) {
            echo $txt['shoutbox_disabled'];
        } else {
            //Check Permissions
            $true1 = shoutboxPermissions('view');
            $true2 = shoutboxPermissions('post');
            if ($true1) {
                loadJquery();
            }
            //Load Smileys.
            if ($true2) {
                $context['shout_dir'] = $adkFolder['main'] . '/smileys';
                $context['shout_dir_found'] = is_dir($context['shout_dir']);
                $context['filenames'] = array();
                if ($context['shout_dir_found']) {
                    if (!file_exists($context['shout_dir'])) {
                        continue;
                    }
                    $dir = dir($context['shout_dir']);
                    while ($entry = $dir->read()) {
                        if (!in_array($entry, $context['filenames']) && in_array(strrchr($entry, '.'), array('.jpg', '.gif', '.jpeg', '.png'))) {
                            $context['filenames'][strtolower($entry)] = array('id' => htmlspecialchars($entry), 'selected' => false);
                        }
                    }
                    $dir->close();
                    ksort($context['filenames']);
                }
                $context['filenames'] = array_values($context['filenames']);
            }
            if ($true1) {
                echo '
				<div id="container3">
					<div class="contente">
							
						<div id="loading">' . $txt['ajax_in_progress'] . '</div>
						
					</div>
				</div>
				<script type="text/javascript" src="' . $adkFolder['shoutbox'] . '/shoutbox.js"></script><br />';
            } else {
                echo '<div class="smalltetext">' . $txt['adkmod_block_shout_now_allowed'] . '</div>';
            }
            //The action post y for security reasons
            if ($true2) {
                echo '
			<form method="post" id="form" action="">
				<table style="width: 100%;">
					', !$context['user']['is_logged'] ? '
					<tr>
						<td style="width: 100%;"><label>' . $txt['user'] . '</label></td></tr>
					<tr>
						<td style="width: 100%;"><input class="text user" id="nick" type="text" size="10" /></td>
					</tr>' : '
					<tr>
						<td style="width: 100%;"><input type="hidden" id="nick" value="' . $user_info['name'] . '" /></td>
					</tr>', '
					<tr>
						<td style="width: 100%; text-align: center;"><textarea rows="3" cols="20" class="text" id="message_shoutbox"></textarea></td>
					</tr>
					<tr>
						<td style="width: 100%; text-align: center;" valign="top">
							<input class="button_submit" id="send" type="submit" value="' . $txt['adkmod_shoutbox_shout_it'] . '" />
						</td>
					</tr>
				</table>
			</form>';
                echo '
			<div style="text-align:center;">
				<a href="javascript:OpenShoutbox(\'shoutbox_smiley\')" title="', $txt['adkmod_block_open_smileys'], '"><img alt="" src="' . $adkFolder['images'] . '/shout_open.png" class="carousel_buttons" /></a>
				<a href="javascript:OpenShoutbox(\'shout_fonts\')"><img alt="" src="' . $adkFolder['images'] . '/shout_a.png" class="carousel_buttons" /></a>
				<a href="javascript:finalUpdate()"><img alt="" src="' . $adkFolder['images'] . '/shout_update.png" class="carousel_buttons" /></a>
				<a href="' . $scripturl . '?action=adk_shoutbox"><img alt="" src="' . $adkFolder['images'] . '/icon_shoutbox.png" class="carousel_buttons" /></a>
			</div>
			<br />';
                echo '
				<div id="shoutbox_smiley" style="display: none;">
				<br />';
                foreach ($context['filenames'] as $smiley) {
                    echo '<img alt="" src="' . $adkFolder['smileys'] . '/' . $smiley['id'] . '" class="adk_pointer" onclick="addSmiley(\':' . $smiley['id'] . ':\')" />';
                }
                echo '
				</div>';
                //Load Fonts, etc
                $things = array('i', 'b', 'u', 's', 'left', 'right', 'center');
                echo '
				<div id="shout_fonts" style="display: none;">';
                foreach ($things as $i) {
                    echo '<img alt="" src="' . $adkFolder['bbcodes'] . '/' . $i . '.gif" class="adk_pointer" onclick="addBBCode(\'' . $i . '\')" />';
                }
                echo '
				</div>';
            }
        }
    }
    if (!empty($context['block']['b'])) {
        echo '
			</div>
		</div>
		<span class="lowerframe">
			<span>&nbsp;</span>	
		</span>
		<br /><div class="adk_height_1"></div>';
    }
}
Пример #2
0
function ShowShoutbox()
{
    global $txt, $adkportal, $context, $smcFunc, $scripturl, $user_info, $boardurl;
    //Load our Custom language
    adkLanguage('Adk-echomodules');
    //id_group?
    $continue = shoutboxPermissions('view');
    //Are you allowed to view shoutbox?
    if (!$continue) {
        fatal_lang_error('adkfatal_shout_now_allowed', false);
    }
    //Load Linktree
    setLinktree('adk_shoutbox', 'adkmodules_shouts');
    //Delete any?
    if (!empty($_REQUEST['del']) && $user_info['is_admin']) {
        deleteShouts((int) $_REQUEST['del']);
    }
    //Template
    adktemplate('Adk-echomodules');
    //Load our css
    $context['html_headers'] .= getCss('modules');
    //Shouts limit
    $shout_limit = 20;
    //Start from?
    $context['start'] = !empty($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
    //Load total shoutbox
    $total = getTotal('adk_shoutbox');
    //Well.... construct page index.
    $context['page_index'] = constructPageIndex($scripturl . '?action=adk_shoutbox', $context['start'], $total, $shout_limit);
    //Load shouts
    $context['shouts'] = getShouts($context['start'], $shout_limit);
    //Show the page_title
    $context['page_title'] = $txt['adkmodules_shouts'];
    //Sub_template
    $context['sub_template'] = 'load_shout';
}