示例#1
0
function messages_compose($user_id, $user_name, $title = null)
{
    $user_name = htmlspecialchars($user_name);
    $user_id = htmlspecialchars($user_id);
    $title = str_replace('"', '\\"', stripslashes($title));
    if ($user_id < 1 && strlen($user_name) > 0) {
        $query = 'SELECT id FROM login WHERE username LIKE "' . str_replace('_', '\\_', $user_name) . '" LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query));
        $data = mysql_fetch_assoc($result);
        $user_id = $data['id'];
    }
    if (strlen($user_name) < 1 && $user_id > 0 && is_numeric($user_id)) {
        $query = 'SELECT username FROM login WHERE id = "' . $user_id . '" LIMIT 1';
        $result = mysql_query($query) or die(report_sql_error($query));
        $data = mysql_fetch_assoc($result);
        $user_name = $data['username'];
    }
    if ($user_id < 1 || strlen($user_name) < 1) {
        return false;
    }
    $fetch['login'] = array('id', 'username', 'regtimestamp', 'regip', 'lastlogon', 'lastip', 'lastaction', 'lastusernamechange', 'lastusername');
    $fetch['userinfo'] = array('contact1', 'contact2', 'gender', 'birthday', 'image', 'forum_signature', 'forum_posts');
    $fetch['traffa'] = array('firstname', 'profile_modules', 'guestbook_entries');
    $userinfo = login_load_user_data($user_id, $fetch);
    traffa_draw_user_div($user_id, $userinfo);
    echo '<div class="grey_faded_div">';
    echo '<h2>Skickar meddelande till ' . $user_name . '</h2>';
    echo '<p>';
    echo '<form name="compose" action="' . $_SERVER['PHP_SELF'] . '?action=send" method="post">';
    echo '<div style="float: right; width: 65px;">';
    echo '<strong>Infoga smilies</strong><br />';
    echo listSmilies('document.compose.message');
    echo '</div>';
    $title = htmlspecialchars(stripslashes($title));
    echo '<strong>Rubrik:</strong> <input type="text" name="title" class="textbox" style="width: 502px;" value="' . $title . '" maxlength="' . MESSAGES_MAX_TITLE_STRLEN . '"/><br />';
    echo '<input type="hidden" name="recipient" value="' . $user_id . '" />';
    echo '<textarea name="message" class="textbox" style="width: 550px; height: 200px;"></textarea><br />';
    echo '</div>';
    echo '<input type="submit" class="button" value="Skicka" />';
    echo '</form>';
    return true;
}
示例#2
0
<div id="list_emoticon">
	<div id="smile_content">
			<?php 
listSmilies();
?>
		<div class="clear"></div>
	</div>
</div>
示例#3
0
function draw_message_form($recipient, $text = null, $errormsg = null)
{
    if (isset($errormsg)) {
        echo '<p style="color: red; font-weight: bold;">' . $errormsg . '</p>';
    } else {
        echo '<p class="subtitle">Skriv nytt meddelande</p>';
    }
    ?>

<?php 
    echo '<form action="/traffa/guestbook.php?action=send_new_message&userid=' . $recipient . '" method="post" name="compose">';
    echo '<textarea name="message" class="textbox" rows="5" cols="75">' . $text . '</textarea><br />';
    echo '<input name="recipient" type="hidden" value="' . $recipient . '" />';
    echo '<strong>Infoga smilies</strong><br />';
    echo listSmilies('document.compose.message') . '<br />';
    echo 'Gör inlägget privat: <input type="checkbox" name="is_private" value="1" /><br />';
    echo '<input type="submit" class="button" value="Skicka!" />';
    echo '</form>';
}
示例#4
0
function drawKlotterplankPostForm($message = NULL)
{
    echo '<div class="grey_faded_div">' . "\n";
    echo '<h2>Klotterplanket - skriv nytt inlägg</h2>' . "\n";
    if ($_SESSION['klotterplank']['lastpost'] > time() - 60) {
        echo '<script language="javascript">' . "\n";
        echo 'function fixtime(input){' . "\n";
        echo 'minutes = Math.round((input / 60) + 0.5) - 1;' . "\n";
        echo 'seconds = input - (minutes * 60);' . "\n";
        echo 'minutes = minutes + "";' . "\n";
        echo 'if(minutes.length < 2){' . "\n";
        echo 'minutes = "0" + minutes;' . "\n";
        echo '}' . "\n";
        echo 'seconds = seconds + "";' . "\n";
        echo 'if(seconds.length < 2){' . "\n";
        echo 'seconds = "0" + seconds;' . "\n";
        echo '}' . "\n";
        echo 'returnval = minutes + ":" + seconds;' . "\n";
        echo 'return returnval;' . "\n";
        echo '}' . "\n";
        echo 'function testtime(){' . "\n";
        echo 'if(input >= 0) {';
        echo 'document.forms.timeleft.counter.value = \'Tid kvar innan du kan posta igen: \' + fixtime(input);' . "\n";
        echo 'input = input - 1;' . "\n";
        echo 'setTimeout("testtime()", 1000);' . "\n";
        echo '}';
        echo 'else {';
        echo 'location.href="';
        echo $_SERVER['PHP_SELF'];
        if (isset($_GET['reload'])) {
            echo '?reload=' . $_GET['reload'];
        }
        echo '";';
        echo '}' . "\n";
        echo '}' . "\n";
        echo '</script>' . "\n";
        echo '<form name="timeleft">' . "\n";
        echo '<input type="text" name="counter" class="subtitle" style="border: none; width: 500px;" disabled="true" />' . "\n";
        echo '</form>' . "\n";
        $timeleft = $_SESSION['klotterplank']['lastpost'] - time() + 60;
        echo '<script language="javascript">' . "\n";
        echo 'var input = ' . $timeleft . ';' . "\n";
        echo 'testtime();' . "\n";
        echo '</script>' . "\n";
    } else {
        echo '<form name="gbform" action="' . $_SERVER['PHP_SELF'];
        if (isset($_GET['reload'])) {
            echo '?reload=' . $_GET['reload'];
        }
        echo '" method="post">' . "\n";
        echo '<textarea tabindex="1" name="message" onkeypress="textCounter(this,5000);" class="textbox" style="width: 530px; height: 90px;">' . $message . '</textarea><br />' . "\n";
        echo '<input type="submit" value="Skicka" name="sendGB" class="button" style="width: 530px;" tabindex="2" />' . "\n";
        echo '<fieldset style="width: 500px;"><legend><b>Infoga smilies</b></legend>' . "\n";
        echo listSmilies('document.gbform.message');
        echo '</fieldset>' . "\n";
        echo '</form>' . "\n";
    }
    echo '</div>' . "\n";
}
示例#5
0
function posts_form($parameters)
{
    if (!login_checklogin()) {
        echo 'Nu gjorde ett script fel här, men det gör inte så mycket.';
        return false;
    } elseif (forum_read_only_get($_SESSION['login']['id'])) {
        echo '<h5>Du är anvstängt från forumet för tillfället.</h5>' . "\n";
        return false;
    }
    $parameters['mode'] = in_array($parameters['mode'], array('post_may_split', 'post_no_split', 'discussion_create')) ? $parameters['mode'] : 'post_may_split';
    $parameters['private_check'] = $parameters['private_check'] === true ? true : false;
    $parameters['submit_button'] = isset($parameters['submit_button']) ? $parameters['submit_button'] : 'Spara &raquo;';
    $parameters['preview_button'] = isset($parameters['preview_button']) ? $parameters['preview_button'] : 'Förhandsgranska &raquo;';
    $parameters['action_url'] = isset($parameters['action_url']) ? $parameters['action_url'] : $_SERVER['PHP_SELF'];
    $parameters['notices_show'] = $parameters['notices_show'] === false ? false : true;
    $parameters['anonymous_allowed'] = $parameters['anonymous_allowed'] === true ? true : false;
    echo '<!-- Post form, sending POST data to ' . $parameters['action_url'] . ' -->' . "\n";
    echo '<a name="post_form"></a>' . "\n";
    echo '<div class="post_form">' . "\n";
    echo '<input type="hidden" id="desired_quality_value" value ="' . $parameters['discussion']['desired_quality'] . '" />';
    echo '<input type="hidden" id="quality_rank_value" value ="' . $parameters['discussion']['quality_rank'] . '" />';
    echo '<h1>' . $parameters['headline'] . '</h1>';
    echo '	<form id="post_form" action="' . $parameters['action_url'] . '" method="post">' . "\n";
    if (isset($parameters['extra_html'])) {
        echo $parameters['extra_html'];
    }
    foreach ($parameters['hidden_inputs'] as $name => $value) {
        echo '		<input type="hidden" name="' . $name . '" value="' . $value . '" />' . "\n";
    }
    echo '	<div class="input_main">' . "\n";
    if ($parameters['mode'] == 'post_may_split') {
        //		echo '<h5>Tillhör ditt inlägg diskussionen "<em>' . $parameters['discussion_title'] . '</em>"?</h5>' . "\n";
        echo '<select id="discussion_split_select" name="discussion_split_select" >';
        echo '<option value="continue_discussion" id="discussion_radio_continue" selected="selected" >';
        echo 'Mitt inlägg tillhör den här diskussionen. (standard)</option>' . "\n";
        echo '<option value="discussion_split" id="discussion_radio_split" />';
        echo 'Jag vill starta en ny underdiskussion.</option>' . "\n";
        echo '<option value="new_discussion" id="discussion_radio_new" />';
        echo 'Jag vill starta en ny diskussion utan anknytning till den här diskussionen.</option>' . "\n";
        echo '</select>';
    }
    echo '	</div>';
    if (in_array($parameters['mode'], array('post_may_split', 'discussion_create'))) {
        echo '	<!-- New discussion dialog, hidden div -->' . "\n";
        echo '	<div id="new_discussion" ' . ($parameters['mode'] == 'discussion_create' ? 'style="display: block;"' : '') . '>' . "\n";
        echo '		<div class="input_left" >';
        echo '			<h5>Välj en rubrik till din nya diskussion</h5>' . "\n";
        echo '			<input id="post_form_subject" type="text" name="title" />' . "\n";
        echo '		</div>';
        //Category choice
        echo '		<div class="input_right" >';
        echo '			<h5>I vilken kategori vill du lägga din diskussion?</h5>' . "\n";
        echo '			<select name="category" >' . "\n";
        global $FORUM_CATEGORIES;
        foreach ($FORUM_CATEGORIES as $main_category) {
            echo '				<optgroup label="' . $main_category['label'] . '">' . "\n";
            foreach ($main_category['sub_categories'] as $handle => $sub_category) {
                echo '					<option value="' . $sub_category['label'] . '"';
                if ($parameters['category_handle'] == $handle) {
                    echo ' selected="selected"';
                } elseif (!isset($parameters['category_handle']) && $handle == 'mellan_himmel_och_jord') {
                    echo ' selected="selected"';
                }
                echo '>' . $sub_category['label'] . '</option>' . "\n";
            }
            echo '				</optgroup>' . "\n";
        }
        echo '			</select>' . "\n\n";
        echo '		</div>';
        //		echo '		<br />';
        //Tags
        echo '<div id="tag_div_button" class="input_left">' . "\n";
        echo '<button class="button_200" onclick="javascript: return posts_show_tag_div();" id="post_form_tag_button">Klicka här för att lägga till nyckelord</button>' . "\n";
        echo '</div>' . "\n";
        echo '		<div id="tag_div_normal"  class="input_left" style="display: none;">';
        echo '			<h5>Tagga din diskussion med nyckelord</h5>' . "\n";
        echo '			<textarea name="tags" rows="" cols=""  >' . $parameters['tags'] . '</textarea>' . "\n";
        echo '		</div>';
        //Rules
        /*
        	echo '		<div class="input_right">';
        	echo '			<h5>Hur seriös är din diskussion?</h5>' . "\n";
        	echo '			<select name="desired_quality" >' . "\n";
        	echo '				<option value="1">Väldigt seriös</option>' . "\n";
        	echo '				<option value="0.5">Ganska seriös</option>' . "\n";
        	echo '				<option value="0">Normalseriös</option>' . "\n";
        	echo '				<option value="-0.5" selected="selected">Ganska oseriös</option>' . "\n";
        	echo '				<option value="-1">Totalt oseriös</option>' . "\n";
        	echo '			</select>' . "\n";
        	echo '		</div>';
        */
        echo '		<div class="input_right">';
        echo '		</div>';
        //Tags help
        /*		echo '		<div class="input_right">';
        		echo '			<p>' . "\n";
        		echo '				Taggar är nyckelord som gör det lättare att hitta intressanta diskussioner. Skriv dina taggar med kommatecken mellan ';
        		echo '				varje ord, vill du diskutera nya 911:an kan du exempelvis skriva <br /><em>porsche, bilar, sportbilar, hästkrafter</em>' . "\n";
        		echo '			</p>' . "\n";
        		echo '		</div>';
        		echo '		</div>';
        */
        echo '		<br />';
        echo '	</div>';
    }
    echo '<div id="post_content_header" class="input_left">' . "\n";
    echo $parameters['mode'] == 'discussion_create' ? '	<h5>Skriv diskussionens första inlägg här</h5>' . "\n" : '<h5>Skriv ditt inlägg här</h5>' . "\n";
    //Discussion watch
    echo '</div>';
    echo '<div id="post_checkboxes" class="input_right">' . "\n";
    $watched = false;
    if (login_checklogin()) {
        $query = 'SELECT * FROM discussion_watches WHERE user_id = ' . $_SESSION['login']['id'] . ' AND discussion_id = ' . $parameters['discussion']['id'];
        $result = mysql_query($query);
        if (mysql_fetch_assoc($result)) {
            $watched = true;
        }
    }
    echo '<input id="forum_discussion_watch_form" name="discussion_watch" type="checkbox" ' . ($watched ? 'checked="checked"' : '') . ' />' . "\n";
    echo '<label for="forum_discussion_watch_form">Bevaka den här diskussionen</label>' . "\n";
    echo '<input id="forum_post_no_smilies" name="no_smilies" type="checkbox" />' . "\n";
    echo '<label for="forum_post_no_smilies">Stäng av smilies</label>' . "\n";
    echo '</div>' . "\n";
    echo '<br />' . "\n";
    echo '<div class="input_module">' . "\n";
    echo '<div class="content_control">';
    /*
    	echo '<select id="content_control_select">' . "\n";
    	echo '<option value="smilies">Smilies</option>' . "\n";
    	echo '<option value="markup">Formattering</option>' . "\n";
    	echo '<option value="notices">Skicka notiser</option>' . "\n";
    	echo '</select>' . "\n";
    */
    /*
    	echo '<div class="control_item" id="control_item_smilies">' . "\n";
    	echo listSmilies('document.getElementById(\'post_form_content\')');
    	echo '</div>' . "\n";
    */
    echo '<h4>Notiser</h4>';
    echo '<div class="control_item" id="control_item_notices">' . "\n";
    for ($i = 1; $i <= 5; $i++) {
        echo '<h5>Användarnamn #' . $i . '</h5>' . "\n";
        echo '<input type="text" name="notice_' . $i . '" />' . "\n";
    }
    echo '</div>' . "\n";
    echo '<h4>Bilder</h4>';
    echo '<div class="control_item" id="control_item_markup">' . "\n";
    echo '!http://sajt.se/bild.jpg!<br />';
    echo '<img src="http://images.hamsterpaj.net/forum_image_example.png" alt="" />';
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    echo '</div>';
    echo '<div class="input_main">' . "\n";
    echo '<textarea name="content" id="post_form_content" rows="" cols="" >' . "\n";
    echo $parameters['content'];
    echo '</textarea>' . "\n";
    echo '</div>';
    if ($parameters['discussion']['desired_quality'] >= 0.5 && isset($parameters['discussion']['desired_quality'])) {
        echo '<div class="input_main" id="quality_warning"><h5>Tänk på att skaparen av den här diskussionen vill ha en seriös diskussion -' . ' inga tramsinlägg eller chattande. Ta tid på dig att formulera dig och granska' . ' gärna ditt inlägg innan du sparar.</h5></div>';
    }
    echo '	<div class="input_main">' . "\n";
    echo '<div class="smilies">' . "\n";
    echo listSmilies();
    echo '</div>' . "\n";
    echo '		<button class="button_150" id="preview_button" ' . ' value="' . $parameters['preview_button'] . '" >' . $parameters['preview_button'] . '</button>' . "\n";
    if ($parameters['private_check']) {
        echo '		<input type="checkbox" name="private" value="true" id="gb_private_check" class="checkbox"/>' . "\n";
        echo '		<label for="gb_private_check">Gör inlägget privat</label>' . "\n";
    }
    echo '	</div>';
    //Preview
    //This div will only be shown after click on preview button
    echo '	<div id="preview">';
    echo '	</div>';
    echo '	<div id="submit_button_div" class="input_main">';
    echo '		<input id="submit_button" type="submit" value="' . $parameters['submit_button'] . '" class="button_60" />' . "\n";
    echo '	</div>';
    echo '	<br style="clear: both;" />' . "\n";
    echo '	</form>' . "\n";
    echo '</div>' . "\n\n";
    // preint_r($parameters);
}