if ($close_poll == POLL_CLOSE_SEVEN_DAYS) { $poll_closes = time() + DAY_IN_SECONDS * 7; } else { if ($close_poll == POLL_CLOSE_THIRTY_DAYS) { $poll_closes = time() + DAY_IN_SECONDS * 30; } else { if ($close_poll == POLL_CLOSE_NEVER) { $poll_closes = false; } } } } } $tid = post_create_thread($fid, $uid, $thread_title, 'Y', 'N'); $pid = post_create($fid, $tid, 0, $uid, 0, ''); poll_create($tid, $poll_questions_array, $poll_closes, $change_vote, $poll_type, $show_results, $poll_vote_type, $option_type, $allow_guests); post_save_attachment_id($tid, $pid, $aid); if (strlen($message_text) > 0) { if ($allow_sig == true && strlen(trim($sig_text)) > 0) { $message_text .= "<div class=\"sig\">{$sig_text}</div>"; } post_create($fid, $tid, 1, $uid, $uid, $message_text); } if ($high_interest == "Y") { thread_set_high_interest($tid); } } if (isset($tid) && $tid > 0) { $uri = "discussion.php?webtag={$webtag}&msg={$tid}.1"; } else { $uri = "discussion.php?webtag={$webtag}";
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)); } } } }
<?php //////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2004 ReloadCMS Development Team // // http://reloadcms.sf.net // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY, without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // // // // This product released under GNU General Public License v2 // //////////////////////////////////////////////////////////////////////////////// if (!empty($_POST['poll_new'])) { rcms_showAdminMessage($lang['results']['polls'][poll_create($_POST['poll_question'], $_POST['poll_variants'])]); } if (!empty($_POST['rmpoll'])) { rcms_showAdminMessage($lang['results']['polls'][poll_remove()]); } if (!poll_is_running()) { $frm = new InputForm("", "post", $lang['general']['submit']); $frm->addbreak($lang['admincp']['poll']['poll']['new']); $frm->hidden('poll_new', '1'); $frm->addrow($lang['poll']['question'], $frm->text_box("poll_question", '', 40)); $frm->addrow($lang['poll']['answers'], $frm->textarea("poll_variants", '', 50, 10), 'top'); $frm->show(); } else { $polldata = poll_get(); $frm = new InputForm("", "post", $lang['general']['submit']); $frm->addrow($lang['poll']['question'] . ': ' . $polldata['q']); foreach ($polldata['v'] as $id => $answer) { $frm->addrow($polldata['c'][$id], $answer);
} break; case 'compose': $output .= '<h1>Fyll bara i formuläret så har du din undersökning på studs!</h1>' . "\n"; $output .= poll_form(); break; case 'create': if ($request['poll']['type'] == 'daily') { $schedule['data'] = serialize($request['poll']); $schedule['release'] = strtotime($request['poll']['release']); $schedule['type'] = 'poll'; schedule_event_add($schedule); $output .= '<h1>Undersökningen på plats! Seså, gör en till tjockis!</h1>' . "\n"; $output .= poll_form(); } else { $handle = poll_create($request['poll']); header('Location: /poll/' . $handle . '.html'); exit; } break; case 'poll_not_found': default: $output = '<h1>Error</h1>'; break; } ui_top($ui_options); echo $output; ui_bottom(); ?>