Spread the word...If we did a good job for you, don't be afraid to tell em who helped ya out.
0 Members and 1 Guest are viewing this topic.
// Shows a login box+welcome message.function ssi_loginWelcome($redirect_to = '', $output_method = 'echo'){ global $scripturl, $txt, $user_info, $context; if ($redirect_to != '') $_SESSION['login_url'] = $redirect_to; if ($output_method != 'echo' || !$user_info['is_guest']) return $user_info['is_guest']; echo ' ', $txt['welcome_guest'], '<br/> ', $context['current_time'], '<br/> <form action="', $scripturl, '?action=login2" method="post" > <table border="0" cellspacing="1" cellpadding="0" class="ssi_table"> <tr> <td align="right"><label for="user">', $txt[35], ':</label> </td> <td><input type="text" name="user" id="user" size="10" /></td> </tr> <tr> <td align="right"><label for="passwrd">', $txt[36], ':</label> </td> <td><input type="password" name="passwrd" id="passwrd" size="10" /></td> </tr> <tr> <td align="right"><label for="cookielength">Length:</label> </td> <td> <select name="cookielength" id="cookielength"> <option value="60">', $txt['smf53'], '</option> <option value="1440">', $txt['smf47'], '</option> <option value="10080">', $txt['smf48'], '</option> <option value="302400">', $txt['smf49'], '</option> <option value="-1" selected="selected">', $txt['smf50'], '</option> </select> </td> </tr> <tr> <td align="right"><input type="submit" value="', $txt[34], '" /></td> </tr> <tr> <td colspan="2">', $txt['smf52'], '</td> </tr> </table> </form>';}
// Recent topic list, with a nice layout to it.function ssi_recentTopics2($output_method = 'echo'){ global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER; global $user_info, $modSettings, $func; $recentPosts = ssi_recentTopics(8, null, 'array'); echo ' <div style="width: 100%; ">'; $count = 1; $max = 9; foreach ($recentPosts as $post){ $count++; echo ' <div class="smalltext"> <a href="', $post['href'], '">', $post['short_subject'], '[/url] </div> <div class="smalltext"> ', $txt[525], ' ', $post['poster']['link'], ' ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', ' </div> <div class="smalltext"> [', $post['time'], '] </div>'; if($count != $max){ echo ' '; } } echo ' </div>';}
// A list of combined stats from board stats,to member stats.function ssi_statsFull($output_method = 'echo'){ global $context, $settings, $options, $scripturl, $txt, $modSettings; $bullet = '<img src="'.$settings['images_url'].'/divider.gif" alt="" border="0" style="margin:0 2px 0 0;" />'; $bullet2 = '<img src="'.$settings['images_url'].'/divider2.gif" alt="" border="0" style="margin:0 2px 0 0;" />'; echo'<div class="smalltext">'; // Members stats. echo ' <img src="'.$settings['images_url'].'/icons/members.gif" style="margin: 0;" align="bottom" alt="" /> <a href="'.$scripturl.'?action=mlist">'.$txt[19].'</a> <br/>'.$bullet.$txt[488].': ' , isset($modSettings['memberCount']) ? $modSettings['memberCount'] : $modSettings['totalMembers'] , ' <br/>'.$bullet.$txt[656]. ': <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '">', $modSettings['latestRealName'], '</a>'; // More stats. echo ' <img src="'.$settings['images_url'].'/icons/info.gif" style="margin: 0;" align="bottom" alt="" /> <a href="'.$scripturl.'?action=stats">'.$txt['stats'].'[/url] <br/>'.$bullet.$txt[489].': '.$modSettings['totalMessages']. ' <br/>'.$bullet. $txt[490].': '.$modSettings['totalTopics']. ' <br/>'.$bullet.$txt['most_online_today'].': '.$modSettings['mostOnlineToday'].' <br/>'.$bullet.$txt['most_online_ever'].': '.$modSettings['mostOnline'].'<br/> ('.timeformat($modSettings['mostDate']).') '; // Add online users. echo '<img src="'.$settings['images_url'].'/icons/online.gif" style="margin: 0;" align="bottom" alt="" /> <a href="'.$scripturl.'?action=who">'.$txt[158].'</a><br/>'; $online = ssi_whosOnline('array'); echo $bullet.$txt['users'].': '.$online['num_users']; echo '<br/>'.$bullet.$txt['guests'].': '.$online['guests']; echo '<br/>'.$bullet.$txt[94].': '.$online['total_users'].' <div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">'; foreach($online['users'] as $user){ echo $bullet2 , $user['hidden'] ? '' . $user['link'] . '' : $user['link']; echo '[br /]'; } echo '</div>'; echo '</div>';}
// Show the latest news, with a nice template... by board.function ssi_boardNews2($board = null, $limit = null, $output_method = 'echo'){ global $scripturl, $db_prefix, $txt, $settings, $modSettings, $context; global $func; $boardNews = ssi_boardNews($board, $limit, null, null, 'array'); foreach ($boardNews as $news) { echo ' <div> <a href="', $news['href'], '"><strong>', $news['subject'], '</strong></a><br/> <div class="smalltext"><strong>', $news['time'], '</strong></div> </div>'; if (!$news['is_last']) echo ' <hr style="margin: 2ex 0;" width="100%" />'; }}
// Show the recent poll from a board.function ssi_boardPoll($board = null, $output_method = 'echo'){ global $db_prefix, $txt, $ID_MEMBER, $settings, $boardurl, $sc, $user_info; global $context; $request = db_query(" SELECT p.ID_POLL, p.question, p.votingLocked, p.hideResults, p.expireTime, p.maxVotes, b.ID_BOARD FROM ({$db_prefix}topics AS t, {$db_prefix}polls AS p, {$db_prefix}boards AS b) LEFT JOIN {$db_prefix}log_polls AS lp ON (lp.ID_POLL = p.ID_POLL AND lp.ID_MEMBER = $ID_MEMBER) WHERE p.votingLocked = 0 AND lp.ID_CHOICE IS NULL AND t.ID_POLL = p.ID_POLL AND t.ID_BOARD = $board AND $user_info[query_see_board] ORDER BY p.ID_POLL DESC LIMIT 1", __FILE__, __LINE__); $row = mysql_fetch_assoc($request); mysql_free_result($request); // Check if they can vote. if (!empty($row['expireTime']) && $row['expireTime'] < time()) $allow_vote = false; elseif (!empty($row['votingLocked'])) $allow_vote = false; else { $request = db_query(" SELECT ID_MEMBER FROM {$db_prefix}log_polls WHERE ID_POLL = $row[ID_POLL] AND ID_MEMBER = $ID_MEMBER LIMIT 1", __FILE__, __LINE__); $allow_vote = mysql_num_rows($request) == 0; mysql_free_result($request); } $request = db_query(" SELECT COUNT(DISTINCT ID_MEMBER) FROM {$db_prefix}log_polls WHERE ID_POLL = $row[ID_POLL]", __FILE__, __LINE__); list ($total) = mysql_fetch_row($request); mysql_free_result($request); $request = db_query(" SELECT ID_CHOICE, label, votes FROM {$db_prefix}poll_choices WHERE ID_POLL = $row[ID_POLL]", __FILE__, __LINE__); $options = array(); $total_votes = 0; while ($rowChoice = mysql_fetch_assoc($request)) { censorText($rowChoice['label']); $options[$rowChoice['ID_CHOICE']] = array($rowChoice['label'], $rowChoice['votes']); $total_votes += $rowChoice['votes']; } mysql_free_result($request); $return = array( 'id' => $row['ID_POLL'], 'image' => empty($pollinfo['votingLocked']) ? 'poll' : 'locked_poll', 'question' => $row['question'], 'total_votes' => $total, 'is_locked' => !empty($pollinfo['votingLocked']), 'allow_vote' => $allow_vote, 'options' => array() ); // Calculate the percentages and bar lengths... $divisor = $total_votes == 0 ? 1 : $total_votes; foreach ($options as $i => $option) { $bar = floor(($option[1] * 100) / $divisor); $barWide = $bar == 0 ? 1 : floor(($bar * 5) / 3); $return['options'][$i] = array( 'id' => 'options-' . $i, 'percent' => $bar, 'votes' => $option[1], 'bar' => '<span style="white-space: nowrap;"><img src="' . $settings['images_url'] . '/poll_left.gif" alt="" /><img src="' . $settings['images_url'] . '/poll_middle.gif" width="' . $barWide . '" height="12" alt="-" /><img src="' . $settings['images_url'] . '/poll_right.gif" alt="" /></span>', 'option' => parse_bbc($option[0]), 'vote_button' => '<input type="' . ($row['maxVotes'] > 1 ? 'checkbox' : 'radio') . '" name="options[]" id="options-' . $i . '" value="' . $i . '" class="check" />' ); } $return['allowed_warning'] = $row['maxVotes'] > 1 ? sprintf($txt['poll_options6'], $row['maxVotes']) : ''; if ($output_method != 'echo') return $return; if ($return['allow_vote']) { echo ' <form action="', $boardurl, '/SSI.php?ssi_function=pollVote" method="post" accept-charset="', $context['character_set'], '"> <input type="hidden" name="poll" value="', $return['id'], '" /> <table border="0" cellspacing="1" cellpadding="0" class="ssi_table"> <tr> <td>', $return['question'], '</td> </tr> <tr> <td>', $return['allowed_warning'], '</td> </tr>'; foreach ($return['options'] as $option) echo ' <tr> <td><label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label></td> </tr>'; echo ' <tr> <td>'; if ($user_info['is_guest']) { echo '<strong>Please login or register to vote.</strong>'; } else { echo '<input type="submit" value="', $txt['smf23'], '" />'; } echo '</td> </tr> </table> <input type="hidden" name="sc" value="', $sc, '" /> </form>'; } else { echo ' <table border="0" cellspacing="1" cellpadding="0" class="ssi_table"> <tr> <td colspan="2">', $return['question'], '</td> </tr>'; foreach ($return['options'] as $option) echo ' <tr> <td align="right" valign="top">', $option['option'], '</td> <td align="left">', $option['bar'], ' ', $option['votes'], ' (', $option['percent'], '%)</td> </tr>'; echo ' <tr> <td colspan="2">', $txt['smf24'], ': ', $return['total_votes'], '</td> </tr> </table>'; }}
TyTy, those are great! Everything you've posted is actually something I have been looking for at one time or another. You might get lots of downloads if you package it up and put it on the SMF modsite.And if you can get those working for 2.0 RC1 too, that'd be great!
Can these be used with T P