Code: Select all
$start = ( isset($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : 0;
Code: Select all
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
AbelaJohnB wrote: MOD Validated/Released
netclectic wrote: in includes/functions_log.php, why is there a big select case statement where the action for each case is exactly the same
Code: Select all
Open includes/function_log.php
Find
case 'edit' :
$time = time();
$sql = "INSERT INTO " . LOGS_TABLE . " (mode, topic_id, user_id, username, user_ip, time)
VALUES ('$action', '$topic_id', '$user_id', '$username', '$user_ip', '$time')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into logs table', '', __LINE__, __FILE__, $sql);
}
break;
After add
case 'announcement' :
$time = time();
$sql = "INSERT INTO " . LOGS_TABLE . " (mode, topic_id, user_id, username, user_ip, time)
VALUES ('$action', '$topic_id', '$user_id', '$username', '$user_ip', '$time')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into logs table', '', __LINE__, __FILE__, $sql);
}
break;
case 'sticky' :
$time = time();
$sql = "INSERT INTO " . LOGS_TABLE . " (mode, topic_id, user_id, username, user_ip, time)
VALUES ('$action', '$topic_id', '$user_id', '$username', '$user_ip', '$time')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into logs table', '', __LINE__, __FILE__, $sql);
}
break;
case 'normal' :
$time = time();
$sql = "INSERT INTO " . LOGS_TABLE . " (mode, topic_id, user_id, username, user_ip, time)
VALUES ('$action', '$topic_id', '$user_id', '$username', '$user_ip', '$time')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into logs table', '', __LINE__, __FILE__, $sql);
}
break;
Open modcp.php
Find
$topic_type = ($mode == 'sticky') ? POST_STICKY : (($mode == 'announce') ? POST_ANNOUNCE : POST_NORMAL);
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_type = " . $topic_type . "
WHERE topic_id IN ($topic_id_sql)
AND topic_moved_id = 0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
}
After add
if ($mode == 'announcement')
{
log_action('announcement', $topic_id_sql, $userdata['user_id'], $userdata['username']);
}
if ($mode == 'sticky')
{
log_action('sticky', $topic_id_sql, $userdata['user_id'], $userdata['username']);
}
morpheus2matrix wrote:netclectic wrote: in includes/functions_log.php, why is there a big select case statement where the action for each case is exactly the same
what do you want to say ?
Code: Select all
Open modcp.php
Find
$topic_type = ($mode == 'sticky') ? POST_STICKY : (($mode == 'announce') ? POST_ANNOUNCE : POST_NORMAL);
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_type = " . $topic_type . "
WHERE topic_id IN ($topic_id_sql)
AND topic_moved_id = 0";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
}
After add
if ($mode == 'announcement')
{
log_action('announcement', $topic_id_sql, $userdata['user_id'], $userdata['username']);
}
if ($mode == 'sticky')
{
log_action('sticky', $topic_id_sql, $userdata['user_id'], $userdata['username']);
}
if ($normalise)
{
log_action('normal', $topic_id_sql, $userdata['user_id'], $userdata['username']);
}