Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6759b97
Logic Error in GenericList.template.php - thanks pcfreak30
Feb 2, 2012
51c7486
Merge https://github.com/Spuds/playpen
Feb 2, 2012
d0bc0e6
+ smc_AutoSuggest for version emulate
Feb 2, 2012
472d4de
Merge https://github.com/Spuds/playpen
Feb 3, 2012
ec66c85
! Consistency of appearance in Edit ban page + xhtml fix (opening tag…
Feb 3, 2012
1a7de1c
! missing comma in query (BanEditTrigger)
Feb 4, 2012
7b108e5
Merge https://github.com/Spuds/playpen
Feb 4, 2012
268268b
! Really fixed xhtml validation in ManageBans.template.php
Feb 5, 2012
e54f813
! Fixed the fix for bug 4890
Feb 5, 2012
5de1d7f
! Really fixed the banned entities list table list headers
Feb 5, 2012
9b4b02e
! Fix IPv4 addresses visualization in banned entities table (ban edit)
Feb 5, 2012
9f72697
! Non global $sourcedir
Feb 5, 2012
28293e9
! delete from multiple tables in one query wrong syntax and not worki…
Feb 6, 2012
d5e0406
Merge https://github.com/Spuds/playpen
Feb 6, 2012
c155c06
! array_intersect for $reservedVars check in makeThemeChanges failed …
Feb 8, 2012
4100d11
! forgot a type="input" in ManageBans.template.php
Feb 8, 2012
3473507
Replaced all the remaining inserts directly in {db_prefix}log_actions…
Feb 8, 2012
8d851d0
Resolved conflicts on common changes
Feb 8, 2012
20d0067
Replaced all the remaining inserts directly in {db_prefix}log_actions…
Feb 8, 2012
7ad87b1
! some more minor doc changes
Spuds Feb 8, 2012
6bb963b
! Things you can't do with empty ....
Spuds Feb 8, 2012
a9d228e
! add missing text string
Spuds Feb 8, 2012
f5b373a
Another array_intersect problem. Thanks asmith and feline for the bug…
Feb 8, 2012
b6480f2
Merge branch 'master' of https://github.com/emanuele45/playpen
Feb 8, 2012
b4d1664
! type="submit" missing
Feb 9, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Sources/Logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ function logAction($action, $extra = array(), $log_type = 'moderate')
'admin' => 3,
);

// No point in doing anything, if the log isn't even enabled.
if (empty($modSettings['modlog_enabled']) || !isset($log_types[$log_type]))
return false;

if (!is_array($extra))
trigger_error('logAction(): data is not an array with action \'' . $action . '\'', E_USER_NOTICE);

Expand Down Expand Up @@ -469,10 +473,6 @@ function logAction($action, $extra = array(), $log_type = 'moderate')
$smcFunc['db_free_result']($request);
}

// No point in doing anything else, if the log isn't even enabled.
if (empty($modSettings['modlog_enabled']) || !isset($log_types[$log_type]))
return false;

if (isset($extra['member']) && !is_numeric($extra['member']))
trigger_error('logAction(): data\'s member is not a number', E_USER_NOTICE);

Expand All @@ -497,14 +497,19 @@ function logAction($action, $extra = array(), $log_type = 'moderate')
}
}

if (isset($extra['member_affected']))
$memID = $extra['member_affected'];
else
$memID = $user_info['id'];

$smcFunc['db_insert']('',
'{db_prefix}log_actions',
array(
'log_time' => 'int', 'id_log' => 'int', 'id_member' => 'int', 'ip' => 'string-16', 'action' => 'string',
'id_board' => 'int', 'id_topic' => 'int', 'id_msg' => 'int', 'extra' => 'string-65534',
),
array(
time(), $log_types[$log_type], $user_info['id'], $user_info['ip'], $action,
time(), $log_types[$log_type], $memID, $user_info['ip'], $action,
$board_id, $topic_id, $msg_id, serialize($extra),
),
array('id_action')
Expand Down
18 changes: 3 additions & 15 deletions Sources/ManageMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -1257,22 +1257,10 @@ function AdminApprove()
{
$log_action = $_POST['todo'] == 'remind' ? 'remind_member' : 'approve_member';
$log_inserts = array();

require_once($sourcedir . '/Logging.php');
foreach ($member_info as $member)
{
$log_inserts[] = array(
time(), 3, $user_info['id'], $user_info['ip'], $log_action,
0, 0, 0, serialize(array('member' => $member['id'])),
);
}
$smcFunc['db_insert']('',
'{db_prefix}log_actions',
array(
'log_time' => 'int', 'id_log' => 'int', 'id_member' => 'int', 'ip' => 'string-16', 'action' => 'string',
'id_board' => 'int', 'id_topic' => 'int', 'id_msg' => 'int', 'extra' => 'string-65534',
),
$log_inserts,
array('id_action')
);
logAction($log_action, array('member' => $member['id']), 'admin');
}

// Although updateStats *may* catch this, best to do it manually just in case (Doesn't always sort out unapprovedMembers).
Expand Down
6 changes: 5 additions & 1 deletion Sources/Profile-Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
function activateAccount($memID)
{
global $sourcedir, $context, $user_profile, $modSettings;
global $sourcedir, $context, $user_profile, $modSettings, $user_info;

isAllowedTo('moderate_forum');

Expand All @@ -43,6 +43,10 @@ function activateAccount($memID)
// Actually update this member now, as it guarantees the unapproved count can't get corrupted.
updateMemberData($context['id_member'], array('is_activated' => $user_profile[$memID]['is_activated'] >= 10 ? 11 : 1, 'validation_code' => ''));

// Log what we did?
require_once($sourcedir . '/Logging.php');
logAction('approve_member', array('member' => $memID), 'admin');

// If we are doing approval, update the stats for the member just in case.
if (in_array($user_profile[$memID]['is_activated'], array(3, 4, 13, 14)))
updateSettings(array('unapprovedMembers' => ($modSettings['unapprovedMembers'] > 1 ? $modSettings['unapprovedMembers'] - 1 : 0)));
Expand Down
28 changes: 13 additions & 15 deletions Sources/Profile-Modify.php
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ function makeNotificationChanges($memID)
*/
function makeCustomFieldChanges($memID, $area, $sanitize = true)
{
global $context, $smcFunc, $user_profile, $user_info, $modSettings;
global $context, $smcFunc, $user_profile, $user_info, $modSettings, $sourcedir;

if ($sanitize && isset($_POST['customfield']))
$_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']);
Expand Down Expand Up @@ -1243,11 +1243,13 @@ function makeCustomFieldChanges($memID, $area, $sanitize = true)
{
$log_changes[] = array(
'action' => 'customfield_' . $row['col_name'],
'id_log' => 2,
'log_time' => time(),
'id_member' => $memID,
'ip' => $user_info['ip'],
'extra' => serialize(array('previous' => !empty($user_profile[$memID]['options'][$row['col_name']]) ? $user_profile[$memID]['options'][$row['col_name']] : '', 'new' => $value, 'applicator' => $user_info['id'])),
'log_type' => 'user',
'extra' => array(
'previous' => !empty($user_profile[$memID]['options'][$row['col_name']]) ? $user_profile[$memID]['options'][$row['col_name']] : '',
'new' => $value,
'applicator' => $user_info['id'],
'member_affected' => $memID,
),
);
$changes[] = array(1, $row['col_name'], $value, $memID);
$user_profile[$memID]['options'][$row['col_name']] = $value;
Expand All @@ -1265,15 +1267,11 @@ function makeCustomFieldChanges($memID, $area, $sanitize = true)
array('id_theme', 'variable', 'id_member')
);
if (!empty($log_changes) && !empty($modSettings['modlog_enabled']))
$smcFunc['db_insert']('',
'{db_prefix}log_actions',
array(
'action' => 'string', 'id_log' => 'int', 'log_time' => 'int', 'id_member' => 'int', 'ip' => 'string-16',
'extra' => 'string-65534',
),
$log_changes,
array('id_action')
);
{
require_once($sourcedir . '/Logging.php');
foreach ($log_changes as $log_change)
logAction($log_change['action'], $log_change['extra'], $log_change['log_type']);
}
}
}

Expand Down
19 changes: 2 additions & 17 deletions Sources/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,24 +619,9 @@ function ModifyProfile($post_errors = array())
if (!empty($context['log_changes']) && !empty($modSettings['modlog_enabled']))
{
$log_changes = array();
require_once($sourcedir . '/Logging.php');
foreach ($context['log_changes'] as $k => $v)
$log_changes[] = array(
'action' => $k,
'id_log' => 2,
'log_time' => time(),
'id_member' => $memID,
'ip' => $user_info['ip'],
'extra' => serialize(array_merge($v, array('applicator' => $user_info['id']))),
);
$smcFunc['db_insert']('',
'{db_prefix}log_actions',
array(
'action' => 'string', 'id_log' => 'int', 'log_time' => 'int', 'id_member' => 'int', 'ip' => 'string-16',
'extra' => 'string-65534',
),
$log_changes,
array('id_action')
);
logAction($k, array_merge($v, array('applicator' => $user_info['id'], 'member_affected' => $memID)), 'user');
}

// Have we got any post save functions to execute?
Expand Down
58 changes: 56 additions & 2 deletions Sources/Subs-Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,9 @@ function html_to_bbc($text)
{
if ($s == 'size')
{
$v = trim($v);
$v = empty($v) ? 1 : (int) $v;
// Cast before empty chech because casting a string results in a 0 and we don't have zeros in the array! ;)
$v = (int) trim($v);
$v = empty($v) ? 1 : $v;
$tags[] = array('[size=' . $sizes_equivalence[$v] . ']', '[/size]');
}
elseif ($s == 'face')
Expand Down Expand Up @@ -2124,6 +2125,7 @@ function AutoSuggestHandler($checkRegistered = null)
// These are all registered types.
$searchTypes = array(
'member' => 'Member',
'versions' => 'SMFVersions',
);

// If we're just checking the callback function is registered return true or false.
Expand Down Expand Up @@ -2191,4 +2193,56 @@ function AutoSuggest_Search_Member()
return $xml_data;
}

function AutoSuggest_Search_SMFVersions()
{

$xml_data = array(
'items' => array(
'identifier' => 'item',
'children' => array(),
),
);

$versions = array(
'SMF 1.1',
'SMF 1.1.1',
'SMF 1.1.2',
'SMF 1.1.3',
'SMF 1.1.4',
'SMF 1.1.5',
'SMF 1.1.6',
'SMF 1.1.7',
'SMF 1.1.8',
'SMF 1.1.9',
'SMF 1.1.10',
'SMF 1.1.11',
'SMF 1.1.12',
'SMF 1.1.13',
'SMF 1.1.14',
'SMF 1.1.15',
'SMF 1.1.16',
'SMF 2.0 beta 1',
'SMF 2.0 beta 1.2',
'SMF 2.0 beta 2',
'SMF 2.0 beta 3',
'SMF 2.0 RC 1',
'SMF 2.0 RC 1.2',
'SMF 2.0 RC 2',
'SMF 2.0 RC 3',
'SMF 2.0',
'SMF 2.0.1',
'SMF 2.0.2',
);

foreach ($versions as $id => $version)
if (strpos($version, strtoupper($_REQUEST['search'])) !== false)
$xml_data['items']['children'][] = array(
'attributes' => array(
'id' => $id,
),
'value' => $version,
);

return $xml_data;
}
?>
45 changes: 11 additions & 34 deletions Sources/Subs-Membergroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function deleteMembergroups($groups)
*/
function removeMembersFromGroups($members, $groups = null, $permissionCheckDone = false)
{
global $smcFunc, $user_info, $modSettings;
global $smcFunc, $user_info, $modSettings, $sourcedir;

// You're getting nowhere without this permission, unless of course you are the group's moderator.
if (!$permissionCheckDone)
Expand Down Expand Up @@ -348,10 +348,7 @@ function removeMembersFromGroups($members, $groups = null, $permissionCheckDone
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$log_inserts[] = array(
time(), 3, $user_info['id'], $user_info['ip'], 'removed_from_group',
0, 0, 0, serialize(array('group' => $group_names[$row['id_group']], 'member' => $row['id_member'])),
);
$log_inserts[] = array('group' => $group_names[$row['id_group']], 'member' => $row['id_member']);
$smcFunc['db_free_result']($request);

$smcFunc['db_query']('', '
Expand Down Expand Up @@ -384,10 +381,7 @@ function removeMembersFromGroups($members, $groups = null, $permissionCheckDone
// What log entries must we make for this one, eh?
foreach (explode(',', $row['additional_groups']) as $group)
if (in_array($group, $groups))
$log_inserts[] = array(
time(), 3, $user_info['id'], $user_info['ip'], 'removed_from_group',
0, 0, 0, serialize(array('group' => $group_names[$group], 'member' => $row['id_member'])),
);
$log_inserts[] = array('group' => $group_names[$group], 'member' => $row['id_member']);

$updates[$row['additional_groups']][] = $row['id_member'];
}
Expand All @@ -409,15 +403,11 @@ function removeMembersFromGroups($members, $groups = null, $permissionCheckDone

// Do the log.
if (!empty($log_inserts) && !empty($modSettings['modlog_enabled']))
$smcFunc['db_insert']('',
'{db_prefix}log_actions',
array(
'log_time' => 'int', 'id_log' => 'int', 'id_member' => 'int', 'ip' => 'string-16', 'action' => 'string',
'id_board' => 'int', 'id_topic' => 'int', 'id_msg' => 'int', 'extra' => 'string-65534',
),
$log_inserts,
array('id_action')
);
{
require_once($sourcedir . 'Logging.php');
foreach ($log_inserts as $extra)
logAction('removed_from_group', $extra, 'admin');
}

// Mission successful.
return true;
Expand Down Expand Up @@ -448,7 +438,7 @@ function removeMembersFromGroups($members, $groups = null, $permissionCheckDone
*/
function addMembersToGroup($members, $group, $type = 'auto', $permissionCheckDone = false)
{
global $smcFunc, $user_info, $modSettings;
global $smcFunc, $user_info, $modSettings, $sourcedir;

// Show your licence, but only if it hasn't been done yet.
if (!$permissionCheckDone)
Expand Down Expand Up @@ -575,22 +565,9 @@ function addMembersToGroup($members, $group, $type = 'auto', $permissionCheckDon

// Log the data.
$log_inserts = array();
require_once($sourcedir . 'Logging.php');
foreach ($members as $member)
$log_inserts[] = array(
time(), 3, $user_info['id'], $user_info['ip'], 'added_to_group',
0, 0, 0, serialize(array('group' => $group_names[$group], 'member' => $member)),
);

if (!empty($log_inserts) && !empty($modSettings['modlog_enabled']))
$smcFunc['db_insert']('',
'{db_prefix}log_actions',
array(
'log_time' => 'int', 'id_log' => 'int', 'id_member' => 'int', 'ip' => 'string-16', 'action' => 'string',
'id_board' => 'int', 'id_topic' => 'int', 'id_msg' => 'int', 'extra' => 'string-65534',
),
$log_inserts,
array('id_action')
);
logAction('added_to_group', array('group' => $group_names[$group], 'member' => $member), 'admin');

call_integration_hook('integrate_add_members_to_group', array($log_inserts));

Expand Down
19 changes: 2 additions & 17 deletions Sources/Subs-Members.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,36 +109,21 @@ function deleteMembers($users, $check_not_admin = false)
if (empty($users))
return;

require_once($sourcedir . 'Logging.php');
// Log the action - regardless of who is deleting it.
$log_inserts = array();
foreach ($user_log_details as $user)
{
// Integration rocks!
call_integration_hook('integrate_delete_member', array($user[0]));

// Add it to the administration log for future reference.
$log_inserts[] = array(
time(), 3, $user_info['id'], $user_info['ip'], 'delete_member',
0, 0, 0, serialize(array('member' => $user[0], 'name' => $user[1], 'member_acted' => $user_info['name'])),
);
logAction('delete_member', array('member' => $user[0], 'name' => $user[1], 'member_acted' => $user_info['name']), 'admin');

// Remove any cached data if enabled.
if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
cache_put_data('user_settings-' . $user[0], null, 60);
}

// Do the actual logging...
if (!empty($log_inserts) && !empty($modSettings['modlog_enabled']))
$smcFunc['db_insert']('',
'{db_prefix}log_actions',
array(
'log_time' => 'int', 'id_log' => 'int', 'id_member' => 'int', 'ip' => 'string-16', 'action' => 'string',
'id_board' => 'int', 'id_topic' => 'int', 'id_msg' => 'int', 'extra' => 'string-65534',
),
$log_inserts,
array('id_action')
);

// Make these peoples' posts guest posts.
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
Expand Down
2 changes: 1 addition & 1 deletion Themes/default/ManageBans.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function template_ban_edit()
<div class="flow_auto">
<div class="floatright">
<div class="additional_row">
[<a href="', $scripturl, '?action=admin;area=ban;sa=edittrigger;bg=', $context['ban']['id'], '">', $txt['ban_add_trigger'], '</a>] <input name="remove_selection" value="', $txt['ban_remove_selected_triggers'], '" class="button_submit" />
[<a href="', $scripturl, '?action=admin;area=ban;sa=edittrigger;bg=', $context['ban']['id'], '">', $txt['ban_add_trigger'], '</a>] <input type="submit" name="remove_selection" value="', $txt['ban_remove_selected_triggers'], '" class="button_submit" />
</div>
</div>
</div>
Expand Down
13 changes: 12 additions & 1 deletion Themes/default/Packages.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,18 @@ function template_browse()
<input type="hidden" name="sa" value="browse" />
</form>
</div>
<br class="clear" />';
<br class="clear" />
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
<script type="text/javascript"><!-- // --><![CDATA[
var oAddMemberSuggest = new smc_AutoSuggest({
sSelf: \'oAddMemberSuggest\',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sControlId: \'ve\',
sSearchType: \'versions\',
bItemList: false
});
// ]]></script>';
}

function template_servers()
Expand Down