TIME, ':name' => 'cronjob_hour']); } /** * Cron Job (24 hours) */ if (fusion_get_settings("cronjob_day") < (TIME - 86400)) { $new_time = TIME; $user_datestamp = [':user_datestamp' => TIME - 86400]; $notify_datestamp = [':notify_datestamp' => TIME - 1209600]; if (defined('FORUM_EXIST')) { dbquery("DELETE FROM ".DB_FORUM_THREAD_NOTIFY." WHERE notify_datestamp <:notify_datestamp", $notify_datestamp); } dbquery("DELETE FROM ".DB_NEW_USERS." WHERE user_datestamp <:user_datestamp", $user_datestamp); dbquery("DELETE FROM ".DB_EMAIL_VERIFY." WHERE user_datestamp <:user_datestamp", $user_datestamp); $usr_inactive = dbcount("(user_id)", DB_USERS, "user_status='3' AND user_actiontime!='0' AND user_actiontime < NOW()"); if ($usr_inactive) { require_once INCLUDES."sendmail_include.php"; $result = dbquery("SELECT user_id, user_name, user_email FROM ".DB_USERS." WHERE user_status=:status AND user_actiontime!=:action_time_start AND user_actiontime < :action_time_end LIMIT 10", [ ':status' => 3, ':action_time_start' => 0, ':action_time_end' => TIME ]); while ($data = dbarray($result)) { dbquery("UPDATE ".DB_USERS." SET user_status=:status, user_actiontime=:actiontime WHERE user_id=:user_id", [':status' => 0, ':actiontime' => 0, ':user_id' => $data['user_id']] ); $subject = $locale['global_451']; $message = str_replace("USER_NAME", $data['user_name'], $locale['global_452']); $message = str_replace("LOST_PASSWORD", fusion_get_settings("siteurl")."lostpassword.php", $message); sendemail($data['user_name'], $data['user_email'], fusion_get_settings("siteusername"), fusion_get_settings("siteemail"), $subject, $message); } if ($usr_inactive > 10) { $new_time = fusion_get_settings("cronjob_day"); } } $usr_deactivate = dbcount("(user_id)", DB_USERS, "user_actiontime < :action_time_start AND user_actiontime!=:action_time_end AND user_status=:user_status", [ ':action_time_start' => TIME, ':action_time_end' => 0, ':user_status' => 7 ] ); if ($usr_deactivate) { $deactivate_param = [ ':action_time_start' => TIME, ':action_time_end' => 0, ':status' => 0, ]; $result = dbquery("SELECT user_id FROM ".DB_USERS." WHERE user_actiontime < :action_time_start AND user_actiontime!=:action_time_end AND user_status=:status LIMIT 10", $deactivate_param); if (fusion_get_settings("deactivation_action") == 0) { while ($data = dbarray($result)) { $deactivate_param[':user_id'] = $data['user_id']; $deactivate_param[':status_6'] = 6; dbquery("UPDATE ".DB_USERS." SET user_actiontime=:action_time_end, user_status=:status_6 WHERE user_id=:user_id", $deactivate_param); } } else { while ($data = dbarray($result)) { dbquery("DELETE FROM ".DB_USERS." WHERE user_id=:user_id", [':user_id' => $data['user_id']]); dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_name=:user_id", [':user_id' => $data['user_id']]); dbquery("DELETE FROM ".DB_MESSAGES." WHERE message_to=:user_id OR message_from=:user_id_2", [':user_id' => $data['user_id'], ':user_id_2' => $data['user_id']]); dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_user=:user_id", [':user_id' => $data['user_id']]); dbquery("DELETE FROM ".DB_SUSPENDS." WHERE suspended_user=:user_id", [':user_id' => $data['user_id']]); if (defined('ARTICLES_EXIST')) { dbquery("DELETE FROM ".DB_ARTICLES." WHERE article_name=:user_id", [':user_id' => $data['user_id']]); } if (defined('NEWS_EXIST')) { dbquery("DELETE FROM ".DB_NEWS." WHERE news_name=:user_id", [':user_id' => $data['user_id']]); } if (defined('MEMBER_POLL_PANEL_EXIST')) { dbquery("DELETE FROM ".DB_POLL_VOTES." WHERE vote_user=:user_id", [':user_id' => $data['user_id']]); } if (defined('FORUM_EXIST')) { dbquery("DELETE FROM ".DB_FORUM_THREADS." WHERE thread_author=:user_id", [':user_id' => $data['user_id']]); dbquery("DELETE FROM ".DB_FORUM_POSTS." WHERE post_author=:user_id", [':user_id' => $data['user_id']]); dbquery("DELETE FROM ".DB_FORUM_THREAD_NOTIFY." WHERE notify_user=:user_id", [':user_id' => $data['user_id']]); } } } if ($usr_deactivate > 10) { $new_time = fusion_get_settings("cronjob_day"); } } dbquery("UPDATE ".DB_SETTINGS." SET settings_value='".$new_time."' WHERE settings_name='cronjob_day'"); }