global $_CONF, $LANG_ADMIN, $LANG_STATIC, $_TABLES, $_PAY_CONF;
    switch ($fieldname) {
        case "user_id":
            if ($A['user_id'] >= 2) {
                $retval = '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['user_id'] . '">' . $A['username'] . '</a>';
            } else {
                $retval = $A['username'];
            }
            break;
        default:
            $retval = stripslashes($fieldvalue);
            break;
    }
    return $retval;
}
//Main
$display = COM_siteHeader('none');
$display .= paypal_admin_menu();
if (!empty($_REQUEST['msg'])) {
    $display .= COM_showMessageText(stripslashes($_REQUEST['msg']), $LANG_PAYPAL_1['message']);
}
switch ($_REQUEST['mode']) {
    default:
        $display .= COM_startBlock($LANG_PAYPAL_1['recurring_list']);
        $display .= PAYPAL_listRecurringPayments();
        $display .= COM_endBlock();
}
$display .= COM_siteFooter();
//For testing
//plugin_runScheduledTask_paypal();
COM_output($display);
            $last_pid = $_REQUEST['id'];
        }
        PAYPAL_saveImage($_REQUEST, $_FILES, $last_pid);
        // save complete, return to product list
        echo COM_refresh($_CONF['site_url'] . '/admin/plugins/paypal/index.php?msg=' . urlencode($msg));
        exit;
        break;
        /* this case is currently not used... future expansion? */
    /* this case is currently not used... future expansion? */
    case 'preview':
        $display = PAYPAL_getProductForm($_REQUEST);
        break;
    case 'edit':
        // Get the product to edit and display the form
        if (is_numeric($_REQUEST['id'])) {
            $sql = "SELECT * FROM {$_TABLES['paypal_products']} WHERE id = {$_REQUEST['id']}";
            $res = DB_query($sql);
            $A = DB_fetchArray($res);
            $display = PAYPAL_getProductForm($A, $A['type']);
        } else {
            echo COM_refresh($_CONF['site_url']);
        }
        break;
    case 'new':
    default:
        $display = PAYPAL_getProductForm(array(), $_REQUEST['type']);
        break;
}
$display = COM_siteHeader('none') . paypal_admin_menu() . $display;
$display .= COM_siteFooter();
COM_output($display);