} // Functions - END // Mighty Gorgon - ACP Privacy - BEGIN $is_allowed = check_acp_module_access(); if (empty($is_allowed)) { message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']); } // Mighty Gorgon - ACP Privacy - END setup_extra_lang(array('lang_bb_db_admin')); $mode = request_var('mode', ''); $action = request_var('action', ''); $mass = request_var('mass', ''); $mass_change = request_var('mass_change', ''); // Auth Check - BEGIN $allowed = false; $founder_id = defined('FOUNDER_ID') ? FOUNDER_ID : get_founder_id(); if ($user->data['user_id'] == $founder_id) { $allowed = true; } if (!$allowed && defined('MAIN_ADMINS_ID')) { $allowed_admins = explode(',', MAIN_ADMINS_ID); if (in_array($user->data['user_id'], $allowed_admins)) { $allowed = true; } } if (!$allowed) { message_die(GENERAL_ERROR, $lang['db_unauthed']); } // Auth Check - END $images = IP_ROOT_PATH . 'images/bb_admin/'; echo '<table class="forumline tw200px">';
/** * <b>first_admin_protection</b> * Checks if submitted user id is the user id of the first admin. If so stop * the script. * * @param $user_id */ function first_admin_protection($user_id) { global $user, $lang; if ($user_id != $user->data['user_id']) { $founder_id = defined('FOUNDER_ID') ? FOUNDER_ID : get_founder_id(); if ($user_id == $founder_id) { message_die(GENERAL_MESSAGE, $lang['ctracker_gmb_1stadmin']); } } }
function check_auth_level($level_required) { global $user, $config; if ($level_required == AUTH_ALL) { return true; } if ($user->data['user_level'] == ADMIN) { if ($level_required == AUTH_ADMIN || $level_required == AUTH_GUEST_ONLY) { return true; } if ($level_required == AUTH_FOUNDER) { $founder_id = defined('FOUNDER_ID') ? FOUNDER_ID : get_founder_id(); return $user->data['user_id'] == $founder_id ? true : false; } elseif ($level_required == AUTH_MAIN_ADMIN) { if (defined('MAIN_ADMINS_ID')) { $allowed_admins = explode(',', MAIN_ADMINS_ID); return in_array($user->data['user_id'], $allowed_admins) ? true : false; } } } // Before going on... if level_required is for Guests only then check if the user is a guest but not a bot... if ($level_required == AUTH_GUEST_ONLY) { return !$user->data['is_bot'] && !$user->data['session_logged_in'] ? true : false; } // Force to AUTH_ADMIN since we already checked all cases for founder or main admins if ($level_required == AUTH_FOUNDER || $level_required == AUTH_MAIN_ADMIN) { $level_required = AUTH_ADMIN; } // Access level required is at least REG and user is not an admin! // Remember that Junior Admin has the ADMIN level while not in CMS or ACP $not_auth = false; // Check if the user is REG or a BOT $is_reg = !empty($config['bots_reg_auth']) && $user->data['is_bot'] || $user->data['session_logged_in'] ? true : false; $not_auth = !$not_auth && $level_required == AUTH_REG && !$is_reg ? true : $not_auth; $not_auth = !$not_auth && $level_required == AUTH_MOD && $user->data['user_level'] != MOD && $user->data['user_level'] != ADMIN ? true : $not_auth; $not_auth = !$not_auth && $level_required == AUTH_ADMIN ? true : $not_auth; if ($not_auth) { return false; } return true; }
/** * Sends a birthday PM */ function birthday_pm_send() { global $db, $cache, $config, $user, $lang; // Birthday - BEGIN // Check if the user has or have had birthday, also see if greetings are enabled if ($user->data['user_birthday'] != 999999 && !empty($config['birthday_greeting']) && create_date('Ymd', time(), $config['board_timezone']) >= $user->data['user_next_birthday_greeting'] . realdate('md', $user->data['user_birthday'])) { // If a user had a birthday more than one week before we will not send the PM... if (time() - gmmktime(0, 0, 0, $user->data['user_birthday_m'], $user->data['user_birthday_d'], $user->data['user_next_birthday_greeting']) <= 86400 * 8) { // Birthday PM - BEGIN $pm_subject = $lang['Greeting_Messaging']; $pm_date = gmdate('U'); $year = create_date('Y', time(), $config['board_timezone']); $date_today = create_date('Ymd', time(), $config['board_timezone']); $user_birthday = realdate('md', $user->data['user_birthday']); $user_birthday2 = ($year . $user_birthday < $date_today ? $year + 1 : $year) . $user_birthday; $user_age = create_date('Y', time(), $config['board_timezone']) - realdate('Y', $user->data['user_birthday']); if (create_date('md', time(), $config['board_timezone']) < realdate('md', $user->data['user_birthday'])) { $user_age--; } $pm_text = $user_birthday2 == $date_today ? sprintf($lang['Birthday_greeting_today'], $user_age) : sprintf($lang['Birthday_greeting_prev'], $user_age, realdate(str_replace('Y', '', $lang['DATE_FORMAT_BIRTHDAY']), $user->data['user_birthday']) . (!empty($user->data['user_next_birthday_greeting']) ? $user->data['user_next_birthday_greeting'] : '')); $founder_id = defined('FOUNDER_ID') ? FOUNDER_ID : get_founder_id(); include_once IP_ROOT_PATH . 'includes/class_pm.' . PHP_EXT; $privmsg_subject = sprintf($pm_subject, $config['sitename']); $privmsg_message = sprintf($pm_text, $config['sitename'], $config['sitename']); $privmsg_sender = $founder_id; $privmsg_recipient = $user->data['user_id']; $privmsg = new class_pm(); $privmsg->delete_older_message('PM_INBOX', $privmsg_recipient); $privmsg->send($privmsg_sender, $privmsg_recipient, $privmsg_subject, $privmsg_message); unset($privmsg); // Birthday PM - END } // Update next greetings year $sql = "UPDATE " . USERS_TABLE . "\n\t\t\tSET user_next_birthday_greeting = " . (create_date('Y', time(), $config['board_timezone']) + 1) . "\n\t\t\tWHERE user_id = " . $user->data['user_id']; $status = $db->sql_query($sql); } //Sorry user shall not have a greeting this year // Birthday - END }