$html_parameters[] = '{"type": "select", "id": "header_size"}';
         $onclick_handlers[] = '{"id": "header_insert", "call": "hp.profile.presentation.change.markup_properties.save()"}';
         $header_sizes['rubrik'] = 'Rubrik';
         $header_sizes['underrubrik'] = 'Underrubrik';
         $header_sizes['minirubrik'] = 'Minirubrik';
         $html_data .= 'Storlek på rubriken: ';
         $html_data .= '<select id="header_size">';
         foreach ($header_sizes as $handle => $text) {
             $html_data .= '<option value="' . $handle . '">' . $text . '</option>';
         }
         $html_data .= '</select>';
         $html_data .= '<input type="button" id="header_insert" class="button_60" value="Infoga" />';
         break;
     case 'poll':
         $html_parameters[] = '{"type": "input_hidden", "id": "choosen_poll_id"}';
         $polls = poll_fetch(array('author' => $_SESSION['login']['id'], 'limit' => 999));
         $onclick_handlers = array();
         $html_data .= '<h2 style="margin: 0px">Välj en av dina omröstningar</h2>';
         $html_data .= 'Klicka på en omröstning för att infoga den i din presentationstext.<br style="clear: both" />';
         $html_data .= '<ul id="profile_presentation_change_markup_properties_poll">';
         foreach ($polls as $poll) {
             $onclick_handlers[] = '{"id": "select_poll_' . $poll['id'] . '", "call": "hp.profile.presentation.change.markup_properties.property_onevent.poll_select(' . $poll['id'] . ')"}';
             $html_data .= '<li id="select_poll_' . $poll['id'] . '">' . $poll['question'] . '</li>';
         }
         $html_data .= '</ul>';
         $html_data .= '<input type="hidden" id="choosen_poll_id" />';
         $html_data .= '<br style="clear: both;" />';
         break;
 }
 $output .= '{ "html": "' . addslashes($html_data) . '", "html_parameters": [' . implode(', ', $html_parameters) . '], "onclick_handlers": [' . implode(', ', $onclick_handlers) . '], "onchange_handlers": [' . implode(', ', $onchange_handlers) . '] }';
 break;
Beispiel #2
0
<?php

require '../include/core/common.php';
include PATHS_INCLUDE . 'libraries/poll.lib.php';
if ($_GET['action'] == 'vote' && is_numeric($_GET['poll_id']) && in_array($_GET['answer_id'], array(1, 2, 3, 4, 5, 6, 7))) {
    echo 'Ok';
    $poll = poll_fetch(array('id' => $_GET['poll_id']));
    preint_r($poll);
    if ($poll[0]['can_answer'] == true) {
        $query = 'UPDATE poll SET alt_' . $_GET['answer_id'] . '_votes = alt_' . $_GET['answer_id'] . '_votes + 1';
        $query .= ' WHERE id = "' . $_GET['poll_id'] . '"';
        mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        if (login_checklogin()) {
            $query = 'INSERT INTO poll_answers (poll_id, user_id, answer_id) VALUES("' . $_GET['poll_id'] . '", "' . $_SESSION['login']['id'] . '", "' . $_GET['answer_id'] . '")';
            mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
        } else {
        }
    }
}
function discussion_forum_insert_poll($matches)
{
    $poll = poll_fetch(array('id' => $matches[1]));
    if (count($poll) == 1) {
        return poll_render($poll[0]);
    }
}
Beispiel #4
0
function poll_get_action($url)
{
    if ($url == '/poll/ny_poll.php') {
        if (strlen($_POST['question']) > 0) {
            $return['action'] = 'create';
            $return['poll'] = $_POST;
        } else {
            $return['action'] = 'compose';
        }
    } elseif (substr($url, -5) == '.html') {
        $return['poll_handle'] = substr($url, strrpos($url, '/') + 1, -5);
        $poll = poll_fetch(array('handle' => $return['poll_handle']));
        if (count($poll) != 1) {
            $return['action'] = 'poll_not_found';
        } else {
            $return['action'] = 'view_poll';
            $return['poll'] = $poll[0];
        }
    } else {
        $return['action'] = 'index';
    }
    return $return;
}
Beispiel #5
0
function profile_presentation_poll_tag_callback($matches)
{
    $poll = poll_fetch(array('id' => $matches[1]));
    if (count($poll) == 1) {
        return poll_render($poll[0]);
    }
}
Beispiel #6
0
function schedule_releases_do($options)
{
    /*
    option		array support	comment
    item_id				yes
    type			yes
    release_after	no
    */
    //trace('schedule', 'Init');
    $options['release_before'] = time();
    $options['released'] = 0;
    $events = schedule_event_fetch($options);
    foreach ($events as $event) {
        //trace('schedule', 'Releasing ' . $event['type']);
        $data = unserialize($event['data']);
        switch ($event['type']) {
            case 'todays_discussion':
                trace('todays_discussion_break', 'Tried to release todays_discussion in ' . __FILE__ . ' on line ' . __LINE__);
                break;
            case 'contest':
                contests_create($data);
                $url = '/taevlingar/';
                $label = $data['title'];
                break;
            case 'poll':
                $poll_handle = poll_create($data);
                $poll = poll_fetch(array('handle' => $poll_handle));
                $post['content'] = '[poll:' . $poll[0]['id'] . ']';
                $post['forum_id'] = 78;
                $post['title'] = 'Undersökning: ' . $poll[0]['question'];
                $post['mode'] = 'new_thread';
                $post['author'] = 2348;
                // Webmaster
                $thread_id = discussion_forum_post_create($post);
                $comment_url = forum_get_url_by_post($thread_id);
                $query = 'UPDATE poll SET comment_url = "' . $comment_url . '" WHERE id = "' . $poll[0]['id'] . '"';
                mysql_query($query);
                $url = '/index.php#poll';
                $label = $data['question'];
                break;
                /* Old sex and sense
                			case 'sex_sense':
                				$entry_id = sex_sense_create($data);
                				$entry = sex_sense_fetch(array('id' => $entry_id));
                				
                				$url = '/sex_och_sinne/' . $entry[0]['category'] . '/' . $entry[0]['handle'] . '.html';
                				$label = $entry[0]['title'];
                
                				break;*/
            /* Old sex and sense
            			case 'sex_sense':
            				$entry_id = sex_sense_create($data);
            				$entry = sex_sense_fetch(array('id' => $entry_id));
            				
            				$url = '/sex_och_sinne/' . $entry[0]['category'] . '/' . $entry[0]['handle'] . '.html';
            				$label = $entry[0]['title'];
            
            				break;*/
            case 'sex_sense':
                try {
                    $entries = sex_sense_fetch_posts($data['fetch_item_options']);
                    if (count($entries) != 1) {
                        throw new Exception('Fel 1 i schedule_releae! Base64(serialize): ' . base64_encode(serialize($data)));
                    }
                    $entry = array_pop($entries);
                    $query = 'UPDATE sex_questions SET is_released = 1 WHERE id = ' . $entry['id'];
                    $label = $entry['title'];
                    $url = '/sex_och_sinne/';
                    $categories = sex_sense_fetch_categories(array('category_id' => $entry['category_id']));
                    foreach ($categories as $category_tree) {
                        $category = array_pop($category_tree);
                        $url .= $category['category_handle'] . '/';
                    }
                    $url .= $entry['handle'] . '.html';
                    // Forum thread creation (main thread)
                    unset($thread);
                    $thread['author'] = '876354';
                    $thread['title'] = $entry['title'];
                    $thread['mode'] = 'new_thread';
                    $thread['forum_id'] = '102';
                    $thread['content'] = $entry['question'];
                    $thread_id = discussion_forum_post_create($thread);
                    $query = 'UPDATE sex_questions SET forum_post_id = ' . $thread_id . ', is_released = 1 WHERE id = ' . $entry['id'];
                    mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
                    // Create forum posts and guestbook notifications for all answers.
                    sex_sense_answer_distribute(array('post_id' => $entry['id']));
                } catch (Exception $error) {
                    trace('sex_sense_schedule', $error->getMessage());
                }
                break;
            case 'music_guess':
                $query = 'INSERT INTO music_guess_songs (secret_id, artist, song, alternate_spellings, timestamp, artist_score, song_score)' . "\n";
                $query .= ' VALUES("' . $data['secret_id'] . '", "' . $data['artist'] . '", "' . $data['song'] . '", "' . addslashes(serialize($data['alternate_spellings'])) . '", "' . time() . '", "' . $data['artist_score'] . '", "' . $data['song_score'] . '")';
                mysql_query($query) or trace('sql_error', $query . ' ' . mysql_error());
                $url = '/mattan/gissa_laaten.php';
                $label = 'Ny låt!';
                break;
            case 'survey':
                survey_create($data);
                $survey = survey_fetch(array('type' => 'front_page'));
                cache_save('fp_survey', $survey);
                $url = '/index.php#survey';
                $label = $data['question'];
                break;
            case 'new_image':
            case 'new_clip':
            case 'new_flash':
            case 'new_background':
            case 'new_software':
            case 'new_prank':
            case 'new_music':
            case 'new_game':
                $url = $data['url'];
                $label = $data['title'];
                break;
        }
        $query = 'INSERT INTO recent_updates (type, label, timestamp, url)' . ' VALUES("' . $event['type'] . '", "' . $label . '", "' . $event['release'] . '", "' . $url . '")';
        $query . '<br />';
        if (!mysql_query($query)) {
            report_sql_error($query, __FILE__, __LINE__);
        } else {
            $query = 'UPDATE scheduled_events SET released = 1 WHERE id="' . $event['id'] . '"';
            if (!mysql_query($query)) {
                report_sql_error($query, __FILE__, __LINE__);
            } else {
                log_to_file('scheduled_events', LOGLEVEL_INFO, __FILE__, __LINE__, 'released  ' . $event['type'] . ' id: ' . $event['id'] . ' ' . date('Y-m-d H:i', $release));
            }
        }
    }
}
Beispiel #7
0
    } else {
        $age_min = $age - 1;
        $age_max = $age + 2;
    }
    $label = $gender == 'f' ? 'Tjejer' : 'Killar';
    $output .= '<input type="submit" value="' . $label . ' på karta" class="button_120" />&nbsp;&nbsp;' . "\n";
    $output .= '</form>' . "\n";
    unset($map_points);
}
/* Downloads ad */
$output .= '<div class="fp_column_ad">' . "\n";
$output .= '<a href="/mattan/ladda_ner_program.php"><img src="' . IMAGE_URL . 'fp_column_ads/downloads.png" /></a>' . "\n";
$output .= '</div>' . "\n";
$output .= '</div>' . "\n";
/* Poll */
$poll = poll_fetch(array('type' => 'daily'));
if ($poll[0]['handle'] == 'skulle_du_kunna_taenka_dig_att_dejta_rojk') {
    $poll[0]['question'] = 'Skulle du kunna tänka dig att dejta <a href="http://www.hamsterpaj.net/traffa/profile.php?id=65654" style="border-bottom: 1px dashed #aaaaaa;">Rojk</a> <img src="http://images.hamsterpaj.net/rojk/rojk.gif" alt="Rojk" />?';
}
if ($poll[0]['can_answer'] == 1 && false) {
    echo '<a name="poll"></a>' . poll_render($poll[0]);
} else {
    $output .= '<br style="clear: both;" /><a name="poll"></a>' . poll_render($poll[0]);
}
$output .= isset($_GET['ilovemarquee']) ? '</div></marquee>' : '';
echo $output;
/*echo '<img src="http://bloggsok.se/BlogPortal/view/SearchEntry?searchText=fra-lagen" width="0" height="0" />';
	echo '<img src="http://bloggsok.se/BlogPortal/view/SearchEntry?searchText=string" width="0" height="0" />';
	echo '<img src="http://bloggsok.se/BlogPortal/view/SearchEntry?searchText=marijuana" width="0" height="0" />';
	echo '<img src="http://bloggsok.se/BlogPortal/view/SearchEntry?searchText=stay-ups" width="0" height="0" />';
	*/