123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <?php
- if (!defined('SMF'))
- die('Hacking attempt...');
- function ModifyKarma()
- {
- global $modSettings, $txt, $user_info, $topic, $smcFunc, $context;
-
- if (empty($modSettings['karmaMode']))
- fatal_lang_error('feature_disabled', true);
-
- is_not_guest();
- isAllowedTo('karma_edit');
- checkSession('get');
-
-
-
- if (!$user_info['is_admin'] && $user_info['posts'] < $modSettings['karmaMinPosts'])
- fatal_lang_error('not_enough_posts_karma', true, array($modSettings['karmaMinPosts']));
-
- if (empty($_REQUEST['uid']) || (int) $_REQUEST['uid'] == $user_info['id'])
- fatal_lang_error('cant_change_own_karma', false);
-
- $_REQUEST['uid'] = (int) $_REQUEST['uid'];
-
- $dir = $_REQUEST['sa'] != 'applaud' ? -1 : 1;
-
- $smcFunc['db_query']('', '
- DELETE FROM {db_prefix}log_karma
- WHERE {int:current_time} - log_time > {int:wait_time}',
- array(
- 'wait_time' => (int) ($modSettings['karmaWaitTime'] * 3600),
- 'current_time' => time(),
- )
- );
-
- $action = 0;
-
- if (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum'))
- {
-
- $request = $smcFunc['db_query']('', '
- SELECT action
- FROM {db_prefix}log_karma
- WHERE id_target = {int:id_target}
- AND id_executor = {int:current_member}
- LIMIT 1',
- array(
- 'current_member' => $user_info['id'],
- 'id_target' => $_REQUEST['uid'],
- )
- );
- if ($smcFunc['db_num_rows']($request) > 0)
- list ($action) = $smcFunc['db_fetch_row']($request);
- $smcFunc['db_free_result']($request);
- }
-
- if (empty($action) || empty($modSettings['karmaWaitTime']))
- {
-
- $smcFunc['db_insert']('replace',
- '{db_prefix}log_karma',
- array('action' => 'int', 'id_target' => 'int', 'id_executor' => 'int', 'log_time' => 'int'),
- array($dir, $_REQUEST['uid'], $user_info['id'], time()),
- array('id_target', 'id_executor')
- );
-
- updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karma_good' : 'karma_bad' => '+'));
- }
- else
- {
-
- if ($action == $dir)
- fatal_lang_error('karma_wait_time', false, array($modSettings['karmaWaitTime'], ($modSettings['karmaWaitTime'] == 1 ? strtolower($txt['hour']) : $txt['hours'])));
-
- $smcFunc['db_query']('', '
- UPDATE {db_prefix}log_karma
- SET action = {int:action}, log_time = {int:current_time}
- WHERE id_target = {int:id_target}
- AND id_executor = {int:current_member}',
- array(
- 'current_member' => $user_info['id'],
- 'action' => $dir,
- 'current_time' => time(),
- 'id_target' => $_REQUEST['uid'],
- )
- );
-
- if ($dir == 1)
- updateMemberData($_REQUEST['uid'], array('karma_good' => '+', 'karma_bad' => '-'));
- else
- updateMemberData($_REQUEST['uid'], array('karma_bad' => '+', 'karma_good' => '-'));
- }
-
- if (!empty($topic))
- redirectexit('topic=' . $topic . '.' . $_REQUEST['start'] . '#msg' . (int) $_REQUEST['m']);
-
- elseif (isset($_REQUEST['f']))
- redirectexit('action=pm;f=' . $_REQUEST['f'] . ';start=' . $_REQUEST['start'] . (isset($_REQUEST['l']) ? ';l=' . (int) $_REQUEST['l'] : '') . (isset($_REQUEST['pm']) ? '#' . (int) $_REQUEST['pm'] : ''));
-
- else
- {
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
- <head>
- <title>...</title>
- <script type="text/javascript"><!-- // --><![CDATA[
- history.go(-1);
- // ]]></script>
- </head>
- <body>«</body>
- </html>';
- obExit(false);
- }
- }
- function BookOfUnknown()
- {
- global $context;
- if (strpos($_GET['action'], 'mozilla') !== false && !isBrowser('gecko'))
- redirectexit('http://www.getfirefox.com/');
- elseif (strpos($_GET['action'], 'mozilla') !== false)
- redirectexit('about:mozilla');
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
- <head>
- <title>The Book of Unknown, ', @$_GET['verse'] == '2:18' ? '2:18' : '4:16', '</title>
- <style type="text/css">
- em
- {
- font-size: 1.3em;
- line-height: 0;
- }
- </style>
- </head>
- <body style="background-color: #444455; color: white; font-style: italic; font-family: serif;">
- <div style="margin-top: 12%; font-size: 1.1em; line-height: 1.4; text-align: center;">';
- if (@$_GET['verse'] == '2:18')
- echo '
- Woe, it was that his name wasn\'t <em>known</em>, that he came in mystery, and was recognized by none. And it became to be in those days <em>something</em>. Something not yet <em id="unknown" name="[Unknown]">unknown</em> to mankind. And thus what was to be known the <em>secret project</em> began into its existence. Henceforth the opposition was only <em>weary</em> and <em>fearful</em>, for now their match was at arms against them.';
- else
- echo '
- And it came to pass that the <em>unbelievers</em> dwindled in number and saw rise of many <em>proselytizers</em>, and the opposition found fear in the face of the <em>x</em> and the <em>j</em> while those who stood with the <em>something</em> grew stronger and came together. Still, this was only the <em>beginning</em>, and what lay in the future was <em id="unknown" name="[Unknown]">unknown</em> to all, even those on the right side.';
- echo '
- </div>
- <div style="margin-top: 2ex; font-size: 2em; text-align: right;">';
- if (@$_GET['verse'] == '2:18')
- echo '
- from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>';
- else
- echo '
- from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>';
- echo '
- </div>
- </body>
- </html>';
- obExit(false);
- }
|