exit;
}
switch ($sort_ranking) {
    case 'general':
        $max_num = 5;
        $step_key = 'general_step';
        $order_key = 'ranking_order';
        break;
    case 'recent':
        $max_num = 2;
        $step_key = 'recent_step';
        $order_key = 'ranking_new_order';
        break;
}
$step_requests = array($step_key => array('i', true, true));
$step_vals = xoonips_admin_get_requests('post', $step_requests);
if ($sort_id >= $max_num || $sort_id < 0 || !isset($step_vals[$step_key][$sort_id])) {
    redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MSG_ILLACCESS);
    exit;
}
$sort_step = $step_vals[$step_key][$sort_id];
$config_keys = array($order_key => 's');
$config_values = xoonips_admin_get_configs($config_keys, 'n');
$current_orders = array_map('intval', explode(',', $config_values[$order_key]));
// adjust sort_step
if ($sort_updown == 'up') {
    if ($current_orders[$sort_id] - $sort_step < 0) {
        $sort_step = $current_orders[$sort_id];
    }
    $sort_diff = -$sort_step;
} else {
//                                                                           //
//  This program 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            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
if (!defined('XOOPS_ROOT_PATH')) {
    exit;
}
// get requests
$get_keys = array('uid' => array('i', false, false), 'upage' => array('i', false, false));
$get_vals = xoonips_admin_get_requests('get', $get_keys);
$uid = $get_vals['uid'];
$upage = $get_vals['upage'];
if (is_null($uid)) {
    // user select
    $title = _AM_XOONIPS_MAINTENANCE_ITEM_DELETE_TITLE;
    $nextaction = 'delete';
    include 'actions/maintenance_item_uselect.php';
    exit;
}
// index select
$title = _AM_XOONIPS_MAINTENANCE_ITEM_DELETE_TITLE;
$description = _AM_XOONIPS_MAINTENANCE_ITEM_DELETE_DESC;
$ticket_area = 'xoonips_admin_maintenance_item_delete';
$index_mode = 'private';
$has_back = true;
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
if (!defined('XOOPS_ROOT_PATH')) {
    exit;
}
// check token ticket
require_once '../class/base/gtickets.php';
$ticket_area = 'xoonips_admin_policy_group';
if (!$xoopsGTicket->check(true, $ticket_area, false)) {
    redirect_header($xoonips_admin['mypage_url'], 3, $xoopsGTicket->getErrors());
    exit;
}
// get variables
$post_keys = array('group_item_number_limit' => array('i', false, true), 'group_index_number_limit' => array('i', false, true), 'group_item_storage_limit' => array('f', false, true));
$post_vals = xoonips_admin_get_requests('post', $post_keys);
$post_vals['group_item_storage_limit'] *= 1000000.0;
// set config keys
$config_keys = array();
foreach ($post_keys as $key => $attributes) {
    list($data_type, $is_array, $required) = $attributes;
    $config_keys[$key] = $data_type;
}
// update db values
foreach ($config_keys as $key => $type) {
    xoonips_admin_set_config($key, $post_vals[$key], $type);
}
redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MSG_DBUPDATED);
//  This program 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            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
if (!defined('XOOPS_ROOT_PATH')) {
    exit;
}
require_once '../class/base/gtickets.php';
// get requests
$request_keys = array('ranking_download_file' => array('s', false, true));
$request_vals = xoonips_admin_get_requests('both', $request_keys);
$filename = $request_vals['ranking_download_file'];
if ($filename == '') {
    redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MSG_ILLACCESS);
    exit;
}
// check token ticket for pathinfo
$ticket_area = 'xoonips_admin_maintenance_ranking';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    if (!$xoopsGTicket->check(false, $ticket_area, false)) {
        redirect_header($xoonips_admin['mypage_url'], 3, $xoopsGTicket->getErrors());
        exit;
    }
}
$download =& xoonips_getutility('download');
if (!$download->check_pathinfo($filename)) {
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
if (!defined('XOOPS_ROOT_PATH')) {
    exit;
}
// check token ticket
require_once '../class/base/gtickets.php';
$ticket_area = 'xoonips_admin_maintenance_ranking';
if (!$xoopsGTicket->check(true, $ticket_area, false)) {
    redirect_header($xoonips_admin['mypage_url'], 3, $xoopsGTicket->getErrors());
    exit;
}
$keys = array('ranking_upload_file' => array('d', true, true));
$vals = xoonips_admin_get_requests('files', $keys);
// uploaded file check
$uploaded_file = $vals['ranking_upload_file'];
if ($uploaded_file['name'] == '' || $uploaded_file['size'] == 0) {
    redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MSG_ILLACCESS);
    exit;
}
// extract sum
$file_path = $uploaded_file['tmp_name'];
$admin_ranking_handler =& xoonips_gethandler('xoonips', 'admin_ranking');
if (!$admin_ranking_handler->load_sum_file($file_path)) {
    redirect_header($xoonips_admin['mypage_url'], 3, _AM_XOONIPS_MAINTENANCE_RANKING_LOCKED);
    exit;
}
redirect_header($xoonips_admin['mypage_url'], 1, _AM_XOONIPS_MSG_DBUPDATED);
require_once '../class/base/gtickets.php';
$ticket_area = 'xoonips_admin_maintenance_account_edit';
if (!$xoopsGTicket->check(true, $ticket_area, false)) {
    redirect_header($xoonips_admin['mypage_url'], 3, $xoopsGTicket->getErrors());
    exit;
}
// get variables
$keys['extra'] = array('uid' => array('i', false, true), 'pass' => array('s', false, true), 'pass2' => array('s', false, true));
$keys['xoops'] = array('uname' => array('s', false, true), 'name' => array('s', false, true), 'email' => array('s', false, true), 'user_viewemail' => array('i', false, false), 'url' => array('s', false, true), 'timezone_offset' => array('s', false, true), 'user_intrest' => array('s', false, true), 'user_sig' => array('s', false, true), 'attachsig' => array('i', false, false), 'umode' => array('s', false, true), 'uorder' => array('s', false, true), 'rank' => array('i', false, true), 'notify_method' => array('i', false, true), 'notify_mode' => array('i', false, true), 'user_mailok' => array('i', false, true));
$keys['xoonips'] = array('posi' => array('i', false, true), 'division' => array('s', false, true), 'company_name' => array('s', false, true), 'tel' => array('s', false, true), 'fax' => array('s', false, true), 'address' => array('s', false, true), 'country' => array('s', false, true), 'zipcode' => array('s', false, true), 'appeal' => array('s', false, true), 'private_item_number_limit' => array('i', false, true), 'private_index_number_limit' => array('i', false, true), 'private_item_storage_limit' => array('f', false, true), 'notice_mail' => array('i', false, true));
$keys['groups'] = array('groups' => array('i', true, false));
// get requests
$vals['extra'] = xoonips_admin_get_requests('post', $keys['extra']);
$vals['xoops'] = xoonips_admin_get_requests('post', $keys['xoops']);
$vals['xoonips'] = xoonips_admin_get_requests('post', $keys['xoonips']);
$vals['groups'] = xoonips_admin_get_requests('post', $keys['groups']);
$uid = $vals['extra']['uid'];
$is_newuser = $uid == 0 ? true : false;
// check requirement variables
function check_variables(&$vals)
{
    $requirements['xoops'] = array('uname', 'email', 'umode', 'uorder', 'rank', 'notify_method', 'notify_mode', 'user_mailok');
    $requirements['xoonips'] = array('private_item_number_limit', 'private_index_number_limit', 'private_item_storage_limit');
    // get requirement fields from xoonips configs
    $check_keys['xoops'] = array('account_realname_optional' => 'name');
    $check_keys['xoonips'] = array('account_company_name_optional' => 'company_name', 'account_division_optional' => 'division', 'account_country_optional' => 'country', 'account_address_optional' => 'address', 'account_zipcode_optional' => 'zipcode', 'account_tel_optional' => 'tel', 'account_fax_optional' => 'fax');
    foreach ($check_keys as $type => $keys) {
        $config_keys = array();
        foreach ($keys as $key => $name) {
            $config_keys[$key] = 's';
        }