![]() 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/ |
<?php
// Mass Update Script - Fix AJAX Navigation for All Pages
// This script systematically updates all remaining pages to support AJAX navigation
echo "๐ Mass AJAX Navigation Update Script\n";
echo "=" . str_repeat("=", 50) . "\n\n";
// Define the pages and their hard redirects that need fixing
$pages_to_fix = [
'artists.php' => [
"window.location.href = `/artist_profile.php?id=\${artistId}`;" => "if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage(`/artist_profile.php?id=\${artistId}`)}else{window.location.href=`/artist_profile.php?id=\${artistId}`;}"
],
'library.php' => [
"window.location.href = url.toString();" => "// Use AJAX to reload content instead of full page redirect\nconst newParams = new URLSearchParams(url.search);\nreloadLibraryContent(newParams);",
"window.location.href = currentUrl.toString();" => "// Use AJAX to reload content instead of full page redirect\nconst newParams = new URLSearchParams(currentUrl.search);\nreloadLibraryContent(newParams);",
"window.location.href = url.pathname + '?' + params.toString();" => "// Use AJAX to reload content instead of full page redirect\nreloadLibraryContent(params);"
],
'notifications.php' => [
"window.location.href = `/artist_profile.php?id=\${userId}`;" => "if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage(`/artist_profile.php?id=\${userId}`)}else{window.location.href=`/artist_profile.php?id=\${userId}`;}"
],
'account_settings.php' => [
"window.location.href = '/credits.php';" => "if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage('/credits.php')}else{window.location.href='/credits.php';}"
],
'track.php' => [
"trackElement.onclick = () => window.location.href = `/track.php?id=\${track.id}`;" => "trackElement.onclick = () => {if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage(`/track.php?id=\${track.id}`)}else{window.location.href=`/track.php?id=\${track.id}`;}};"
]
];
// Add checkout.php to allowed pages if not already there
$checkout_pages = ['checkout.php', 'checkout copy.php', 'checkout copy 2.php'];
foreach ($checkout_pages as $page) {
if (file_exists($page)) {
$pages_to_fix[$page] = [];
}
}
$updated_files = [];
$errors = [];
echo "๐ Processing Files:\n";
foreach ($pages_to_fix as $file => $replacements) {
if (!file_exists($file)) {
echo "โ ๏ธ $file - File not found, skipping\n";
continue;
}
echo "๐ง Processing $file...\n";
$content = file_get_contents($file);
$original_content = $content;
$changes_made = 0;
foreach ($replacements as $old => $new) {
$count = 0;
$content = str_replace($old, $new, $content, $count);
if ($count > 0) {
echo " โ
Replaced $count occurrence(s) of redirect pattern\n";
$changes_made += $count;
}
}
// Generic replacements for common patterns
$generic_patterns = [
"/window\.location\.href = '\/auth\/login\.php';/" => "if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage('/auth/login.php')}else{window.location.href='/auth/login.php';}",
"/window\.location\.href = '\/auth\/register\.php';/" => "if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage('/auth/register.php')}else{window.location.href='/auth/register.php';}",
"/window\.location\.href = '\/dashboard\.php';/" => "if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage('/dashboard.php')}else{window.location.href='/dashboard.php';}",
"/window\.location\.href = '\/library\.php';/" => "if(window.ajaxNavigation){window.ajaxNavigation.navigateToPage('/library.php')}else{window.location.href='/library.php';}",
];
foreach ($generic_patterns as $pattern => $replacement) {
$count = 0;
$content = preg_replace($pattern, $replacement, $content, -1, $count);
if ($count > 0) {
echo " โ
Applied generic pattern: $count replacements\n";
$changes_made += $count;
}
}
if ($changes_made > 0) {
if (file_put_contents($file, $content)) {
echo " ๐พ Saved $file with $changes_made changes\n";
$updated_files[] = $file;
} else {
echo " โ Failed to save $file\n";
$errors[] = "Failed to save $file";
}
} else {
echo " โน๏ธ No changes needed for $file\n";
}
echo "\n";
}
// Update AJAX loader to include checkout pages
echo "๐ง Updating AJAX loader configuration...\n";
$ajax_loader_file = 'ajax_load_page.php';
if (file_exists($ajax_loader_file)) {
$ajax_content = file_get_contents($ajax_loader_file);
// Add checkout pages if not already there
$additional_pages = [
"'checkout' => 'checkout.php'",
"'credits' => 'credits.php'",
"'account_settings' => 'account_settings.php'",
"'profile' => 'profile.php'",
"'terms' => 'terms.php'",
"'privacy' => 'privacy.php'",
"'features' => 'features.php'"
];
foreach ($additional_pages as $page_entry) {
if (strpos($ajax_content, $page_entry) === false) {
// Add before the closing bracket
$ajax_content = str_replace(
"'admin' => 'admin.php'\n];",
"'admin' => 'admin.php',\n " . $page_entry . "\n];",
$ajax_content
);
echo " โ
Added " . explode("'", $page_entry)[1] . " to AJAX loader\n";
}
}
file_put_contents($ajax_loader_file, $ajax_content);
}
// Update AJAX navigation script
echo "๐ง Updating AJAX navigation script...\n";
$ajax_nav_file = 'js/ajax_navigation.js';
if (file_exists($ajax_nav_file)) {
$nav_content = file_get_contents($ajax_nav_file);
// Add additional pages to the shouldHandleWithAjax list
$additional_nav_pages = [
"'/checkout.php'",
"'/credits.php'",
"'/account_settings.php'",
"'/profile.php'",
"'/terms.php'",
"'/privacy.php'",
"'/features.php'"
];
foreach ($additional_nav_pages as $page) {
if (strpos($nav_content, $page) === false) {
$nav_content = str_replace(
"'/admin.php'\n ];",
"'/admin.php',\n " . $page . "\n ];",
$nav_content
);
echo " โ
Added $page to AJAX navigation\n";
}
}
// Add URL parsing for new pages
$url_parsing_additions = [
"checkout.php" => "checkout",
"credits.php" => "credits",
"account_settings.php" => "account_settings",
"profile.php" => "profile",
"terms.php" => "terms",
"privacy.php" => "privacy",
"features.php" => "features"
];
foreach ($url_parsing_additions as $file => $type) {
$pattern = "} else if (pathname.includes('$file')) {\n return { pageType: '$type', params };";
if (strpos($nav_content, $pattern) === false) {
$nav_content = str_replace(
"} else if (pathname.includes('admin.php')) {\n return { pageType: 'admin', params };\n }",
"} else if (pathname.includes('admin.php')) {\n return { pageType: 'admin', params };\n " . $pattern . "\n }",
$nav_content
);
echo " โ
Added URL parsing for $file\n";
}
}
file_put_contents($ajax_nav_file, $nav_content);
}
// Summary
echo str_repeat("=", 60) . "\n";
echo "๐ UPDATE SUMMARY:\n";
echo str_repeat("=", 60) . "\n";
if (!empty($updated_files)) {
echo "โ
SUCCESS: Updated " . count($updated_files) . " files with AJAX navigation\n\n";
echo "๐ Updated Files:\n";
foreach ($updated_files as $file) {
echo " - $file\n";
}
echo "\n";
} else {
echo "โน๏ธ No files required updates\n\n";
}
if (!empty($errors)) {
echo "โ ๏ธ ERRORS:\n";
foreach ($errors as $error) {
echo " โ $error\n";
}
echo "\n";
}
echo "๐ต AJAX Navigation Updates Complete!\n";
echo "๐งช Test the updated pages to ensure global player persistence\n";
echo "๐ Monitor performance with /ajax_dashboard.php\n";
echo str_repeat("=", 60) . "\n";
?>