T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/soundstudiopro.com/private_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/private_html/COMMUNITY_AJAX_FIX.md
# Community Page AJAX Bug Fix

## Issue
The `community_fixed.php` page had an AJAX bug where filtering and searching caused full page reloads instead of using AJAX navigation, which could break the global player state and cause navigation issues.

## Root Cause
The `filterTracks()` and `performSearch()` functions were using `window.location.href` which forces a full page reload, bypassing the AJAX navigation system.

## Fix Applied

### Updated Functions
1. **`performSearch()`** - Now checks for AJAX navigation availability and uses it if present
2. **`filterTracks()`** - Now checks for AJAX navigation availability and uses it if present

### Changes Made
- Both functions now check if `window.ajaxNavigation.navigateToPage` is available
- If available, they use AJAX navigation to update the page content
- If not available, they fall back to full page reload (for compatibility)
- Both functions now reset pagination to page 1 when filters/search change

## Code Changes

**Before:**
```javascript
function performSearch() {
    const searchTerm = document.getElementById('search-input').value;
    const url = new URL(window.location);
    url.searchParams.set('search', searchTerm);
    window.location.href = url.toString(); // Full page reload
}

function filterTracks() {
    // ... build URL ...
    window.location.href = url.toString(); // Full page reload
}
```

**After:**
```javascript
function performSearch() {
    const searchTerm = document.getElementById('search-input').value;
    const url = new URL(window.location);
    url.searchParams.set('search', searchTerm);
    url.searchParams.delete('page'); // Reset to page 1
    
    // Use AJAX navigation if available
    if (window.ajaxNavigation && typeof window.ajaxNavigation.navigateToPage === 'function') {
        window.ajaxNavigation.navigateToPage(url.pathname + url.search);
    } else {
        window.location.href = url.toString(); // Fallback
    }
}

function filterTracks() {
    // ... build URL ...
    url.searchParams.delete('page'); // Reset to page 1
    
    // Use AJAX navigation if available
    if (window.ajaxNavigation && typeof window.ajaxNavigation.navigateToPage === 'function') {
        window.ajaxNavigation.navigateToPage(url.pathname + url.search);
    } else {
        window.location.href = url.toString(); // Fallback
    }
}
```

## Benefits
1. ✅ Preserves global player state when filtering/searching
2. ✅ Faster page updates (no full reload)
3. ✅ Better user experience
4. ✅ Maintains browser history correctly
5. ✅ Backward compatible (falls back to full reload if AJAX not available)

## Testing
- [x] Filter by sort (Latest/Most Popular) - Should use AJAX
- [x] Filter by time (All Time/Today/This Week/This Month) - Should use AJAX
- [x] Filter by genre - Should use AJAX
- [x] Search functionality - Should use AJAX
- [x] Pagination links - Should work with AJAX navigation (already handled by link interception)
- [x] Fallback behavior - Should work if AJAX navigation not available

## Files Modified
- `community_fixed.php` - Updated `performSearch()` and `filterTracks()` functions

## Date
January 2025


CasperSecurity Mini