<?php /** * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ * CC-BY License - http://creativecommons.org/licenses/by/3.0/ */ require_once '../inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin.inc.php'; bx_import('BxDolPaginate'); bx_import('BxDolAdminIpBlockList'); $logged['admin'] = member_auth(1, true, true); $oBxDolAdminIpBlockList = new BxDolAdminIpBlockList(); $sResult = ''; switch (bx_get('action')) { case 'apply_delete': $oBxDolAdminIpBlockList->ActionApplyDelete(); break; } $iNameIndex = 3; $_page = array('name_index' => $iNameIndex, 'css_name' => array('ip_blacklist.css'), 'js_name' => array(), 'header' => _t('_adm_ipbl_title'), 'header_text' => _t('_adm_ipbl_title')); $aPages = array('manage' => array('title' => _t('_adm_txt_manage'), 'url' => BX_DOL_URL_ADMIN . 'ip_blacklist.php?mode=manage', 'func' => 'PageCodeManage', 'func_params' => array()), 'list' => array('title' => _t('_adm_txt_list'), 'url' => BX_DOL_URL_ADMIN . 'ip_blacklist.php?mode=list', 'func' => 'PageCodeIpMembers', 'func_params' => array()), 'settings' => array('title' => _t('_Settings'), 'url' => BX_DOL_URL_ADMIN . 'ip_blacklist.php?mode=settings', 'func' => 'PageCodeSettings', 'func_params' => array())); if (!isset($_GET['mode']) || !isset($aPages[$_GET['mode']])) { $sMode = 'manage'; } else { $sMode = $_GET['mode']; } $aTopItems = array(); foreach ($aPages as $k => $r) { $aTopItems['dbmenu_' . $k] = array('href' => $r['url'], 'title' => $r['title'], 'active' => $k == $sMode ? 1 : 0);
function clean_database() { $db_clean_vkiss = (int) getParam("db_clean_vkiss"); $db_clean_profiles = (int) getParam("db_clean_profiles"); $db_clean_msg = (int) getParam("db_clean_msg"); $db_clean_visits = (int) getParam("db_clean_members_visits"); $db_clean_banners_info = (int) getParam("db_clean_banners_info"); //clear from `sys_banners_shows` if (db_res("DELETE FROM `sys_banners_shows` WHERE `Date` < UNIX_TIMESTAMP( NOW() - INTERVAL {$db_clean_banners_info} DAY )")) { db_res("OPTIMIZE TABLE `sys_banners_shows`"); } //clear from `sys_banners_clicks` if (db_res("DELETE FROM `sys_banners_clicks` WHERE `Date` < UNIX_TIMESTAMP( NOW() - INTERVAL {$db_clean_banners_info} DAY )")) { db_res("OPTIMIZE TABLE `sys_banners_clicks`"); } // clear from `sys_messages` if (db_res("DELETE FROM `sys_messages` WHERE FIND_IN_SET('sender', `Trash`) AND FIND_IN_SET('recipient', `Trash`)")) { db_res("OPTIMIZE TABLE `sys_messages`"); } //clear from `sys_ip_members_visits` if (db_res("DELETE FROM `sys_ip_members_visits` WHERE `DateTime` < NOW() - INTERVAL {$db_clean_visits} DAY")) { db_res("OPTIMIZE TABLE `sys_ip_members_visits`"); } // clear ban table if (db_res("DELETE FROM `sys_admin_ban_list` WHERE `DateTime` + INTERVAL `Time` SECOND < NOW()")) { db_res("OPTIMIZE TABLE `sys_admin_ban_list`"); } // profile_delete if ($db_clean_profiles > 0) { $res = db_res("SELECT `ID` FROM `Profiles` WHERE (`DateLastNav` < NOW() - INTERVAL {$db_clean_profiles} DAY) AND (`Couple` > `ID` OR `Couple` = 0)"); if ($res) { $db_clean_profiles_num = mysql_num_rows($res); while ($arr = mysql_fetch_array($res)) { profile_delete($arr['ID']); } db_res("OPTIMIZE TABLE `Profiles`"); } } if ($db_clean_vkiss > 0) { $res = db_res("DELETE FROM `sys_greetings` WHERE `When` < NOW() - INTERVAL {$db_clean_vkiss} DAY"); if ($res) { $db_clean_vkiss_num = db_affected_rows(); db_res("OPTIMIZE TABLE `sys_greetings`"); } } if ($db_clean_msg > 0) { $res = db_res("DELETE FROM `sys_messages` WHERE `Date` < NOW() - INTERVAL {$db_clean_msg} DAY"); if ($res) { $db_clean_msg_num = db_affected_rows(); db_res("OPTIMIZE TABLE `sys_messages`"); } } //--- Clean sessions ---// bx_import('BxDolSession'); $oSession = BxDolSession::getInstance(); $iSessions = $oSession->oDb->deleteExpired(); // clean expired ip bans bx_import('BxDolAdminIpBlockList'); $oBxDolAdminIpBlockList = new BxDolAdminIpBlockList(); $iIps = $oBxDolAdminIpBlockList->deleteExpired(); // clean old views bx_import('BxDolViews'); $oBxViews = new BxDolViews('', 0); $iDeletedViews = $oBxViews->maintenance(); // clean old votes bx_import('BxDolVoting'); $oBxVotes = new BxDolVoting('', 0); $iDeletedVotes = $oBxVotes->maintenance(); echo "\n- Database cleaning -\n"; echo "Deleted profiles: {$db_clean_profiles_num}\n"; echo "Deleted virtual kisses: {$db_clean_vkiss_num}\n"; echo "Deleted messages: {$db_clean_msg_num}\n"; echo "Deleted sessions: {$iSessions}\n"; echo "Deleted records from ip block list: {$iIps}\n"; echo "Deleted views: {$iDeletedViews}\n"; echo "Deleted votes: {$iDeletedVotes}\n"; }
* http://creativecommons.org/licenses/by/3.0/ * * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the Creative Commons Attribution 3.0 License for more details. * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, * see license.txt file; if not, write to marketing@boonex.com ***************************************************************************/ require_once '../inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin.inc.php'; bx_import('BxDolPaginate'); bx_import('BxDolAdminIpBlockList'); $logged['admin'] = member_auth(1, true, true); $oBxDolAdminIpBlockList = new BxDolAdminIpBlockList(); $sResult = ''; switch (bx_get('action')) { case 'apply_delete': $oBxDolAdminIpBlockList->ActionApplyDelete(); $sResult .= $oBxDolAdminIpBlockList->GenIPBlackListTable(); break; } $sStoredHistory = getParam('enable_member_store_ip') == 'on' ? $oBxDolAdminIpBlockList->GenStoredMemIPs() : ''; bx_import('BxTemplFormView'); $oForm = new BxTemplFormView($_page); $iNameIndex = 3; $_page = array('name_index' => $iNameIndex, 'css_name' => array(), 'js_name' => array(), 'header' => _t('_adm_ipbl_title'), 'header_text' => _t('_adm_ipbl_title')); $_page_cont[$iNameIndex]['page_result_code'] = $sResult; $sWrappedContent = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode() . $oBxDolAdminIpBlockList->getManagingForm() . $oBxDolAdminIpBlockList->GenIPBlackListTable() . $sStoredHistory)); $_page_cont[$iNameIndex]['page_main_code'] = $sWrappedContent;