Пример #1
0
function poll_form($poll)
{
    $output .= '<form method="post" action="/poll/ny_poll.php" class="poll_create_form">' . "\n";
    $output .= '<div class="column_1">' . "\n";
    $output .= '<h5>Vilken fråga vill du ställa?</h5>' . "\n";
    $output .= '<input type="text" name="question" class="text_input" />' . "\n";
    $output .= '<h5>Vill du skriva en förklarande text?</h5>' . "\n";
    $output .= '<textarea name="description" class="text_input"></textarea>' . "\n";
    $output .= '<h5>Vilka alternativ ska finnas?</h5>' . "\n";
    $output .= '<ol>' . "\n";
    for ($i = 1; $i <= 7; $i++) {
        $output .= '<li><input type="text" name="alt_' . $i . '" class="text_input" /></li>' . "\n";
    }
    $output .= '</ol>' . "\n";
    $output .= '</div>' . "\n";
    $output .= '<div class="column_2">' . "\n";
    if (is_privilegied('frontpage_poll_admin')) {
        $output .= '<h5>Vad är det för sorts undersökning?</h5>' . "\n";
        $output .= '<select name="type">' . "\n";
        $output .= '<option value="user" onclick="document.getElementById(\'poll_release_control\').style.display = \'none\';">Egen undersökning</option>' . "\n";
        $output .= '<option value="daily" onclick="document.getElementById(\'poll_release_control\').style.display = \'block\';">Dagens fråga på förstasidan</option>' . "\n";
        $output .= '</select>' . "\n";
        $output .= '<div id="poll_release_control">' . "\n";
        $output .= '<h5>När skall undersökningen publiceras?</h5>' . "\n";
        $output .= '<input type="text" name="release" value="' . date('Y-m-d H:i', schedule_release_get(array('type' => 'poll'))) . '" />' . "\n";
        $output .= '</div>' . "\n";
    }
    $output .= '<h5>Vilka får svara?</h5>' . "\n";
    $output .= '<input name="force_logon" value="1" type="radio" id="poll_form_force_logon_true" />' . "\n";
    $output .= '<label for="poll_form_force_logon_true">Låt bara Hamsterpaj-medlemmar svara</label><br />' . "\n";
    $output .= '<input name="force_logon" value="0" type="radio" id="poll_form_force_logon_false" />' . "\n";
    $output .= '<label for="poll_form_force_logon_false">Låt alla svara, även besökare</label><br />' . "\n";
    $output .= '<input type="submit" value="Skapa undersökning" class="button_140" />' . "\n";
    $output .= '</div>' . "\n";
    $output .= '<br style="clear: both;" />' . "\n";
    $output .= '</form>' . "\n";
    return $output;
}
Пример #2
0
function sex_sense_schedule_add($options)
{
    if (!isset($options['id'])) {
        throw new Exception('Missing parameter id for sex_sense_schedule_add()!');
    }
    $release = schedule_release_get(array('type' => 'sex_sense'));
    $data = serialize(array('fetch_item_options' => array('id' => $options['id'], 'ignore_no_posts_found_error' => true, 'is_released' => 0), 'url' => $options['url'], 'title' => $options['title']));
    schedule_event_add(array('data' => $data, 'type' => 'sex_sense', 'release' => $release, 'item_id' => $options['id']));
}
Пример #3
0
/**
* Draws the form where you can add or edit a film.
	$film	an array with all film data
*/
function films_admin_form_draw($film_type, $film = null, $options)
{
    rounded_corners_top();
    if (isset($film)) {
        //		preint_r($film);
        echo '<h1>Redigera film</h1>' . "\n";
    } else {
        echo '<h1>Lägg in en ny film</h1>' . "\n";
    }
    /*
    	echo '<h2>Ladda upp en filmfil:</h2>' . "\n";
    	echo '<form id="film_upload_form" method="post" target="film_upload_frame" action="/film/admin/film_upload_user.php">' . "\n";
    	echo '<input type="file" name="film_upload" />' . "\n";
    	echo '<input type="submit" class="button_80" value="Skicka" />' . "\n";
    	echo '</form>' . "\n";
    	echo '<iframe name="film_upload_frame" style="display: none;" ></iframe>' . "\n";
    */
    echo '<h2>eller klistra in länk till filmfilen:</h2>' . "\n";
    echo '<input type="text" name="fetch_link" id="film_fetch_link_input"/>' . "\n";
    echo '<button class="button_50" id="film_fetch_link_button">Skicka</button>' . "\n";
    if (isset($film)) {
        echo '<input type="checkbox" name="upload_new_file" id="upload_new_file" />' . "\n";
        echo '<label for="upload_new_file" >Uppdatera filmfilen</label>' . "\n";
    }
    echo '<div id="film_preview">' . "\n";
    echo '</div>' . "\n";
    echo '<form id="film_edit_form" method="post" action="/' . $film_type . '/admin/' . (isset($film) ? 'film_save.php' : 'film_new.php') . '" enctype="multipart/form-data">' . "\n";
    if (isset($film)) {
        echo '<input name="film_id" type="hidden" value="' . $film['id'] . '" />' . "\n";
    }
    echo '<h2>Titel</h2>' . "\n";
    echo '<input type="text" name="title" value="' . (isset($film) ? $film['title'] : '') . '" />' . "\n";
    echo '<h2>Filmtyp <strong>Byt absolut inte här, gå istället in på rätt sida!</strong></h2>' . "\n";
    $film_type = isset($film) ? $film['film_type'] : $film_type;
    echo '<input type="radio" name="film_type" value="flash" id="film_type_radio_flash" ' . ($film_type == 'flash' ? 'checked="on"' : '') . '/>' . "\n";
    echo '<label for="film_type_radio_flash">Flash</label>' . "\n";
    echo '<input type="radio" name="film_type" value="klipp" id="film_type_radio_klipp" ' . ($film_type == 'klipp' ? 'checked="on"' : '') . '/>' . "\n";
    echo '<label for="film_type_radio_klipp">Klipp</label>' . "\n";
    echo '<input type="radio" name="film_type" value="bilder" id="film_type_radio_bilder" ' . ($film_type == 'bilder' ? 'checked="on"' : '') . '/>' . "\n";
    echo '<label for="film_type_radio_bilder">Bild</label>' . "\n";
    echo '<h2>Kategori</h2>' . "\n";
    global $film_categories;
    global $film_type_categories;
    //	preint_r($film_categories);
    //	preint_r($film_type_categories[$film_type]);
    foreach ($film_type_categories[$film_type] as $category_id) {
        $categories[$category_id] = $film_categories[$category_id];
    }
    //	preint_r($categories);
    echo '<select name="film_category">' . "\n";
    foreach ($categories as $category_id => $category) {
        echo '<option value="' . $category_id . '"';
        if (isset($film) && $film['category_id'] == $category_id) {
            echo ' selected="selected"';
        }
        echo ' >' . $category['title'] . '</option>' . "\n";
    }
    echo '</select>' . "\n";
    echo '<h2>Övriga nyckelord (separerade med mellanslag)</h2>' . "\n";
    if (isset($film)) {
        unset($keywords);
        $tags = tag_get_by_item('film', $film['id']);
        foreach ($tags as $tag) {
            $keywords[] = $tag['label'];
        }
    }
    preint_r($keywords);
    echo '<textarea name="tags" rows="3" cols="60" >' . (isset($film) ? implode(' ', $keywords) : '') . '</textarea>' . "\n";
    echo '<h2>Bild (skalas och konverteras automagiskt)</h2>' . "\n";
    if (isset($film)) {
        echo '<img src="' . IMAGE_URL . '/film/' . $film['handle'] . '.png" />' . "\n";
    }
    echo '<input name="thumbnail" type="file" />' . "\n";
    echo '<h2>Release</h2>' . "\n";
    echo '<input type="text" name="release" value="' . date('Y-m-d H:i', isset($film) ? $film['release'] : schedule_release_get(array('type' => 'new_' . $film_type))) . '" />' . "\n";
    echo '<input type="checkbox" name="release_now" value="true" id="release_now_check" />' . "\n";
    echo '<label for="release_now_check">Släpp filmen direkt</label>' . "\n";
    echo '<h2>Specialkod</h2>' . "\n";
    echo '<input type="checkbox", value="true", id="chk_use_special_code" name="use_special_code" ' . (isset($film) && $film['use_special_code'] == 1 ? 'checked=checked' : '') . '/>' . "\n";
    echo '<label for="chk_use_special_code">Använd specialkod</label>' . "\n";
    echo '<textarea name="special_code" rows="5" cols="60" >' . (isset($film) ? stripslashes($film['html']) : '') . '</textarea>' . "\n";
    echo '<br />' . "\n";
    echo '<h2>Filmtrailer.se ID (rör ej om du inte vet vad detta är!)</h2>' . "\n";
    echo '<input type="text" name="trailer_id" value="' . $film['trailer_id'] . '" />' . "\n";
    echo '<input type="checkbox", value="delete" id="chk_film_delete" name="delete" />' . "\n";
    echo '<label for="chk_film_delete">Ta bort film</label>' . "\n";
    echo '<input class="button_50" type="submit" value="Spara" />' . "\n";
    echo '</form>' . "\n";
    rounded_corners_bottom();
}
Пример #4
0
/**
* Draws the form where you can add or edit an entertainment item.
	$item	an array with all item data
*/
function entertain_admin_form_draw($entertain_type, $item = null, $preview = null, $options)
{
    global $entertain_types;
    global $entertain_categories;
    global $entertain_type_categories;
    // create a new item, start by upload och post fetch link
    if (!isset($item) && !isset($preview)) {
        $mode = 'upload_new';
    } elseif (!isset($item) && isset($preview)) {
        $mode = 'preview_new';
    } elseif (isset($item) && isset($preview)) {
        $mode = 'preview_replace';
    } else {
        $mode = 'edit';
    }
    //$output .= '<p>mode: ' . $mode . '</p>';
    $entertain_type = isset($item) ? $item['entertain_type'] : $entertain_type;
    $output .= '<span class="admin">' . "\n";
    if (isset($item)) {
        $output .= '<h1>Redigera ' . $entertain_types[$entertain_type]['label'] . '</h1>' . "\n";
    } else {
        $output .= '<h1>Lägg in ' . $entertain_types[$entertain_type]['label'] . '</h1>' . "\n";
    }
    $output .= '<p>Eftersom Henrik har fulkodat den här skiten är det <strong>jätteviktigt</strong> att du fyller i både namn och laddar upp en bild!</p>' . "\n";
    if ($mode == 'edit') {
        $output .= '<button id="entertain_upload_form_show_button" class="button_150">Ladda upp ny fil</button>' . "\n";
    }
    //	preint_r($_SESSION['new_entertain_temp']);
    // Upload form
    $output .= '<div id="entertain_upload_form" ' . ($mode != 'upload_new' ? ' style="display: none;"' : '') . '>' . "\n";
    $output .= '<h2>Ladda upp en fil:</h2>' . "\n";
    $output .= '<form id="entertain_upload_form" enctype="multipart/form-data" method="post" action="/' . $entertain_types[$entertain_type]['url_handle'] . '/admin/' . (isset($item) ? $item['handle'] . '.html' : '') . '">' . "\n";
    $output .= '<input type="hidden" name="action"';
    if ($mode == 'upload_new') {
        $output .= ' value="upload_new"';
    } else {
        $output .= ' value="upload_replace"';
    }
    $output .= '>' . "\n";
    $output .= '<input type="file" name="entertain_upload" />' . "\n";
    $output .= '<h2>eller klistra in länk till filen:</h2>' . "\n";
    $output .= '<input type="text" name="fetch_link" id="entertain_fetch_link_input"/>' . "\n";
    $output .= '<input type="submit" class="button_80" value="Skicka" />' . "\n";
    $output .= '</form>' . "\n";
    $output .= '</div>' . "\n";
    if ($mode == 'preview_new' || $mode == 'preview_replace') {
        $output .= '<div id="entertain_preview" >' . "\n";
        $output .= $preview;
        $output .= '</div>' . "\n";
        $output .= '<div id="entertain_preview_buttons">' . "\n";
        $output .= '<h2>Kan du se filmen/spelet/bilden?</h2>' . "\n";
        $output .= '<button class="button_150" id="entertain_preview_ok_button">Ja, gå vidare</button>' . "\n";
        $output .= '<button class="button_150" id="entertain_preview_retry_button">Nej, försök igen</button>' . "\n";
        $output .= '</div>' . "\n";
    }
    // Edit form
    $output .= '<form id="entertain_edit_form" ' . ($mode != 'edit' ? ' style="display: none;"' : '') . ' method="post" action="/' . $entertain_types[$entertain_type]['url_handle'] . '/admin/';
    switch ($mode) {
        case 'preview_replace':
            $output .= 'item_save_and_update_file';
            break;
        case 'preview_new':
            $output .= 'item_save_new';
            break;
        case 'edit':
            $output .= 'item_save';
            break;
    }
    $output .= '.php" enctype="multipart/form-data">' . "\n";
    if (isset($item)) {
        $output .= '<input name="item_id" type="hidden" value="' . $item['id'] . '" />' . "\n";
    }
    $output .= '<dl>' . "\n";
    // Title
    $output .= '<dt>Titel</dt>' . "\n";
    $output .= '<dd>' . "\n";
    $output .= '<input type="text" name="title" value="' . (isset($item) ? $item['title'] : '') . '" />' . "\n";
    $output .= '</dd>' . "\n";
    // Category
    foreach ($entertain_type_categories[$entertain_type] as $id) {
        $temp_category_ids[$entertain_categories[$id]['handle']] = $id;
    }
    ksort($temp_category_ids);
    $output .= '<dt>Kategori</dt>' . "\n";
    $output .= '<dd>' . "\n";
    $output .= '<select name="entertain_category">' . "\n";
    foreach ($temp_category_ids as $category_id) {
        $output .= '<option value="' . $category_id . '"';
        if (isset($item) && $item['category_id'] == $category_id) {
            $output .= ' selected="selected"';
        }
        $output .= ' >' . $entertain_categories[$category_id]['title'] . '</option>' . "\n";
    }
    $output .= '</select>' . "\n";
    $output .= '</dd>' . "\n";
    // Keywords (tags)
    /*	These are hidden for now, waiting for a decision on using tags (or not)
    	$output .= '<dt>Övriga nyckelord (separerade med mellanslag)</dt>' . "\n";
    	$output .= '<dd>' . "\n";
    	if(isset($item))
    	{
    		unset($keywords);
    		$tags = tag_get_by_item('entertain', $item['id']);
    		foreach($tags as $tag)
    		{
    			$keywords[] = $tag['label'];
    		}
    	}
    	$output .= '<textarea name="tags" rows="3" cols="60" >' . (isset($item) ? implode(' ', $keywords) : '') . '</textarea>' . "\n";
    	$output .= '</dd>' . "\n";
    */
    // Image - used for thumbnail image, image types create thumbnails from the object itself
    if (!in_array($entertain_type, array('image', 'background', 'software'))) {
        $output .= '<dt>Bild (skalas och konverteras automatiskt) <strong>OBS! Du måste ladda upp en bild!</strong></dt>' . "\n";
        $output .= '<dd>' . "\n";
        if (isset($item)) {
            $output .= '<img src="' . IMAGE_URL . 'entertain/' . $item['handle'] . '.png" />' . "\n";
        }
        $output .= '<input name="thumbnail" type="file" />' . "\n";
        $output .= '</dd>' . "\n";
    }
    if (in_array($entertain_typ, array('software'))) {
        $output .= '<dt>Länk</dt>' . "\n";
        $output .= '<dd>' . "\n";
        $value = isset($item['link']) ? '' : '';
        $output .= '<input type="text" name="link" value="' . $value . '"/>' . "\n";
        $output .= '</dd>' . "\n";
    }
    // Release
    $output .= '<dt>Release</dt>' . "\n";
    $output .= '<dd>' . "\n";
    $output .= '<input type="text" name="release" value="' . date('Y-m-d H:i', isset($item) ? $item['release'] : schedule_release_get(array('type' => 'new_' . $entertain_type))) . '" />' . "\n";
    $output .= '<input type="checkbox" name="release_now" value="true" id="release_now_check" />' . "\n";
    $output .= '<label for="release_now_check">Släpp direkt</label>' . "\n";
    $output .= '</dd>' . "\n";
    // Special code
    $output .= '<dt>Specialkod</dt>' . "\n";
    $output .= '<dd>' . "\n";
    $output .= '<input type="checkbox", value="true", id="chk_use_special_code" name="use_special_code" ' . (isset($item) && $item['use_special_code'] == 1 ? 'checked=checked' : '') . '/>' . "\n";
    $output .= '<label for="chk_use_special_code">Använd specialkod</label>' . "\n";
    $output .= '<br />' . "\n";
    $output .= '<textarea name="special_code" rows="5" cols="60" >' . (isset($item) ? stripslashes($item['html']) : '') . '</textarea>' . "\n";
    $output .= '</dd>' . "\n";
    // Trailer id
    if ($entertain_type == 'clip') {
        $output .= '<dt>Filmtrailer.se ID (rör ej om du inte vet vad detta är!)</dt>' . "\n";
        $output .= '<dd>' . "\n";
        $output .= '<input type="text" name="trailer_id" value="' . (isset($item['trailer_id']) ? $item['trailer_id'] : '') . '" />' . "\n";
        $output .= '</dd>' . "\n";
    }
    if ($entertain_type == 'software') {
        $output .= '<dt>Länk till webbsida</dt>' . "\n";
        $output .= '<dd>' . "\n";
        $output .= '<input type="text" name="link" value="' . $item['link'] . '" />' . "\n";
        $output .= '</dd>' . "\n";
    }
    // Description
    $output .= '<dt>Beskrivning</dt>' . "\n";
    $output .= '<dd>' . "\n";
    $output .= '<textarea name="description" rows="6" cols="60" >' . (isset($item) ? $item['description'] : '') . '</textarea>' . "\n";
    $output .= '</dd>' . "\n";
    // Game controls
    if ($entertain_type == 'game') {
        $output .= '<dt>Kontroller</dt>' . "\n";
        $output .= '<dd>' . "\n";
        $output .= '<table>' . "\n";
        for ($i = 0; $i < 8; $i++) {
            $output .= '<tr>' . "\n";
            $output .= '<td><input type="text" name="key_' . $i . '" value="' . (is_array($item['controls']) ? $item['controls'][$i]['combination'] : '') . '"></td>';
            $output .= '<td><input type="text" name="action_' . $i . '" value="' . (is_array($item['controls']) ? $item['controls'][$i]['description'] : '') . '"></td>';
            $output .= '</tr>' . "\n";
        }
        $output .= '</table>' . "\n";
        $output .= '</dd>' . "\n";
        $output .= '<dt>Highscore gname (låt bli om du inte vet vad detta är!)</dt>' . "\n";
        $output .= '<dd>' . "\n";
        $output .= '<input type="text" name="highscore_gname" value="' . $item['highscore_gname'] . '" /><br />' . "\n";
        $output .= '</dd>' . "\n";
    }
    // Delete item
    if (isset($item)) {
        $output .= '<dt>Redera</dt>' . "\n";
        $output .= '<dd>' . "\n";
        $output .= '<input type="checkbox", value="delete" id="chk_entertain_delete" name="delete" />' . "\n";
        $output .= '<label for="chk_item_delete">Ta bort ' . $entertain_types[$entertain_type]['label'] . '</label>' . "\n";
        $output .= '</dd>' . "\n";
    }
    $output .= '</dl>' . "\n";
    $output .= '<input class="button_50" type="submit" value="Spara" />' . "\n";
    $output .= '</form>' . "\n";
    $output .= '</span>' . "\n";
    return $output;
}
Пример #5
0
function fun_images_admin_form()
{
    echo '<h2>Ladda upp en ny bild</h2>' . "\n";
    echo '<form action="/kul/roliga_bilder/upload.php" method="post" enctype="multipart/form-data">' . "\n";
    echo '<h3>Namn</h3>' . "\n";
    echo '<input type="text" name="title" />' . "\n";
    echo '<h3>Beskrivning/kommentar/förklaring (bara om det behövs)</h3>' . "\n";
    echo '<textarea name="description"></textarea>' . "\n";
    echo '<h3>Kategori</h3>' . "\n";
    echo '<select name="category">' . "\n";
    $result = mysql_query('SHOW COLUMNS FROM fun_images LIKE "category"');
    $types = mysql_result($result, 0, "Type");
    $types = substr($types, 5, strlen($types) - 6);
    $i = 1;
    foreach (explode(',', $types) as $value) {
        $severity[$value] = $i++;
    }
    foreach ($severity as $key => $value) {
        echo '<option value="' . substr($key, 1, -1) . '">' . substr($key, 1, -1) . '</option>' . "\n";
    }
    echo '</select>' . "\n";
    echo '<h3>Ladda upp fil</h3>' . "\n";
    echo '<input type="file" name="file" />' . "\n";
    echo '<h3>Release</h3>' . "\n";
    $release = time();
    echo '<input type="text" name="release" value="' . date('Y-m-d H:i', schedule_release_get(array('type' => 'fun_images'))) . '" />' . "\n";
    echo '<input type="checkbox" name="release_now" value="true" id="fun_images_release_now"/>' . "\n";
    echo '<label for="fun_images_release_now">Släpp omedelbart</label><br />' . "\n";
    echo '<input type="submit" value="Ladda upp" />' . "\n";
    echo '</form>' . "\n";
}
Пример #6
0
     if (strlen($_POST['artist3']) > 0) {
         $data['alternate_spellings']['artist'] = $_POST['artist3'];
     }
     if (strlen($_POST['song1']) > 0) {
         $data['alternate_spellings']['artist'] = $_POST['song1'];
     }
     if (strlen($_POST['song2']) > 0) {
         $data['alternate_spellings']['artist'] = $_POST['song2'];
     }
     if (strlen($_POST['song3']) > 0) {
         $data['alternate_spellings']['artist'] = $_POST['song3'];
     }
     copy($hp_path . 'music_guess/mp3/' . $_POST['file_id'] . '_' . $_POST['file_version'] . '.mp3', '/mnt/images/music_guess_mp3/' . $data['secret_id'] . '.mp3');
     $schedule['type'] = 'music_guess';
     $schedule['data'] = serialize($data);
     $schedule['release'] = schedule_release_get(array('type' => 'music_guess'));
     schedule_event_add($schedule);
     rename('/mnt/amuse/music_guess/' . $_POST['original_filename'], '/mnt/amuse/music_guess/_KLAR_' . $_POST['original_filename']);
     echo '<h1>Sparat! <a href="/admin/music_guess.php">Lägg in en ny låt</a></h1>' . "\n";
 } else {
     echo '<ul style="list-style-type: none;">' . "\n";
     $dir = opendir('/mnt/amuse/music_guess/');
     while ($filename = readdir($dir)) {
         if ($filename != '.' && $filename != '..') {
             $filenames[] = $filename;
         }
     }
     sort($filenames);
     foreach ($filenames as $filename) {
         echo '<li style="line-height: 25px;"><a href="?filename=' . urlencode($filename) . '">' . utf8_encode($filename) . '</a></li>' . "\n";
     }
Пример #7
0
<?php 
        }
        $counter++;
    }
}
function contests_create($contest)
{
    $query = 'INSERT INTO contests(time_created, time_end, title, description, value, url, prize_value_cirka) ';
    $query .= 'VALUES("' . $contest['time_created'] . '", "' . $contest['time_end'] . '", "' . $contest['title'] . '", "' . $contest['description'];
    $query .= '", "' . $contest['value'] . '", "' . $contest['url'] . '", "' . $contest['prize_value_cirka'] . '")';
    mysql_query($query) or die(report_sql_error($query));
    $contest_id = mysql_insert_id();
    $options['item_id'] = $contest_id;
    $options['object_type'] = 'contest';
    $options['tag_label'] = $contest['tags'];
    tag_set_wrap($options);
    preint_r($options);
    return $contest_id;
}
function contests_form()
{
    global $contest_tags;
    echo '<div class="contests_form">' . "\n";
    echo '<form action="/taevlingar/admin.php?action=create" method="post">' . "\n";
    echo '<h3>Tävlingsrubrik</h3>' . "\n";
    echo '<input type="text" name="title" value="' . $contest['title'] . '" class="textbox" />' . "\n";
    echo '<h3>Beskrvining</h3>' . "\n";
    echo '<textarea name="description" class="textbox">' . htmlspecialchars($contest['description']) . '</textarea>' . "\n";
    echo '<h3>Vinstens värde</h3>' . "\n";
    echo '<input type="text" name="value" value="' . $contest['value'] . '" class="textbox" />' . "\n";
    echo '<input type="checkbox" name="prize_value_cirka" id="check_prize_value_cirka" />' . "\n";
    echo '<label for="check_prie_value_cirka">Värdet är ungefärligt</label>' . "\n";
    echo '<h3>Slutdatum</h3>' . "\n";