uninstall(); break; case 'restore': $this->restore(); break; } echo '

Uninstall Preparation

'; echo '
'; echo '

'; echo 'For some installations, you won\'t be able to delete '.CMS_NAME.'\'s data files from your server untill the access permissions have been changed. '; echo ' This script will change file permissions for files and folders in the /data directory to 0777.'; echo '
You should not continue unless you plan on deleting all '.CMS_NAME.' files from your server.'; echo ''; echo ' '; //echo ' '; echo '

'; echo '
'; echo '

Change Your Mind?

'; echo '
'; echo 'You can restore the file permissions for added security here: '; echo ''; echo ''; echo '
'; } private function restore(){ global $dataDir; $chmodDir = $dataDir.'/data'; $this->DirPermission = 0777; //0755; $this->FilePermission = 0666; //0644; //0600 is too restrictive $this->chmoddir($chmodDir); message('The file permissions have been updated.'); } private function uninstall(){ global $dataDir; $chmodDir = $dataDir.'/data'; $this->DirPermission = 0777; $this->FilePermission = 0777; //0666; $this->chmoddir($chmodDir); message('The file permissions have been updated.'); } private function chmoddir($dir){ global $config; $files = array(); if( !file_exists($dir) ){ return $files; } $dh = @opendir($dir); if( !$dh ){ return $files; } while( ($file = readdir($dh)) !== false){ if( ($file == '.') || ($file == '..') ){ continue; } $fullPath = $dir.'/'.$file; if( is_dir($fullPath) ){ if( !isset($config['useftp']) ){ //dirs will already be 0777 when using ftp if( !@chmod($fullPath,$this->DirPermission) ){ continue; } } $this->chmoddir($fullPath); }else{ @chmod($fullPath,$this->FilePermission); } } } }