0) ? '(?i)' : ''; $htaccess_file = getcwd() . "/.htaccess"; $contents = ''; $basePath = parse_url($sugar_config['site_url'], PHP_URL_PATH); if (empty($basePath)) { $basePath = '/'; } $cacheDir = $sugar_config['cache_dir']; $restrict_str = << Options +SymLinksIfOwnerMatch Options -Indexes RewriteEngine On RewriteBase {$basePath} RewriteRule ^cache/jsLanguage/(.._..).js$ index.php?entryPoint=jslang&modulename=app_strings&lang=$1 [L,QSA] RewriteRule ^cache/jsLanguage/(\w*)/(.._..).js$ index.php?entryPoint=jslang&modulename=$1&lang=$2 [L,QSA] RewriteRule ^cache/jsLanguage/(.._..).js$ index.php?entryPoint=jslang&module=app_strings&lang=$1 [L,QSA] RewriteRule ^cache/jsLanguage/(\w*)/(.._..).js$ index.php?entryPoint=jslang&module=$1&lang=$2 [L,QSA] # --------- DEPRECATED -------- RewriteRule ^api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteRule ^api/(.*?)$ lib/API/public/index.php/$1 [L] # ----------------------------- RewriteRule ^Api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteRule ^Api/access_token$ Api/index.php/access_token [L] RewriteRule ^Api/V8/(.*?)$ Api/index.php/V8/$1 [L] RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [R=301,L] # END SUGARCRM RESTRICTIONS EOQ; if (file_exists($htaccess_file)) { $fp = fopen($htaccess_file, 'r'); $skip = false; while ($line = fgets($fp)) { if (preg_match('/\s*#\s*BEGIN\s*SUGARCRM\s*RESTRICTIONS/i', $line)) { $skip = true; } if (!$skip) { $oldcontents .= $line; } if (preg_match('/\s*#\s*END\s*SUGARCRM\s*RESTRICTIONS/i', $line)) { $skip = false; } } } if (substr($contents, -1) != "\n") { $restrict_str = "\n" . $restrict_str; } $status = file_put_contents($htaccess_file, $contents . $restrict_str); if (!$status) { echo '

' . $mod_strings['LBL_HT_NO_WRITE'] . "{$htaccess_file}

\n"; echo '

' . $mod_strings['LBL_HT_NO_WRITE_2'] . "

\n"; echo "{$redirect_str}\n"; } // new content should be prepended to the file file_put_contents($htaccess_file, $oldcontents, FILE_APPEND); // cn: bug 9365 - security for filesystem $uploadDir = ''; $uploadHta = ''; if (empty($GLOBALS['sugar_config']['upload_dir'])) { $GLOBALS['sugar_config']['upload_dir'] = 'upload/'; } $uploadHta = "upload://.htaccess"; $denyAll = <<\n"; }