Checking File and Folder Permissions

Statistics for important files that must be CHMOD\'ed and writable:

'; $important_files = array( 'index.php', 'data/', ); if(!$handle = opendir("./data")){ die("
Cannot open directory ./data "); } while (false !== ($file = readdir($handle))){ if($file != '.' and $file != '..'){ $important_files[] = "data/$file"; } } closedir($handle); $chmod_errors = 0; $not_found_errors = 0; foreach($important_files as $file){ $file_name = $my_path . $file; if(!file_exists($file_name)){ $file_status = "not found, check whether it is uploaded!"; $not_found_errors ++; } elseif(is_writable($file_name)){ $file_status = "writable"; } else{ @chmod("$file_name", 0777); if(is_writable($file_name)){ $file_status = "writable"; }else{ @chmod("$file_name", 0755); if(is_writable($file_name)){ $file_status = "Writable"; }else{ $file_status = "Not Writable"; $chmod_errors ++; } } } $chmod_value = @decoct(@fileperms($my_path . $file)) % 1000; echo"
"; } if($chmod_errors == 0 and $not_found_errors == 0){ $status_report = 'The tests were completed successfully and no errors were encountered. You may now proceed to the final installation step'; }else{ if($chmod_errors > 0){ $status_report = "Error encountered during the permissions check, $chmod_errors of the files were not writable, you must CHMOD them to 777 using your FTP program.
(basically the files that must be CHMODed are all files and folders in the data/ directory)

Proceeding with installation is NOT recommended.
"; } if($not_found_errors > 0){ $status_report .= "Error encountered during the permissions check, $not_found_errors of the files were not found, make sure you uploaded them in the correct folder.

Proceeding with installation is NOT recommended.
"; } } echo""; echo'
 
 File / Folder Current CHMOD Status
 $file_name   $chmod_value   $file_status
 
 
Overall Status Report
$status_report
'; } // ******************************************************************************** // Do Configure // ******************************************************************************** elseif($action == "doconfig") { $url = preg_replace( "'/index.php'", "", $HTTP_SERVER_VARS['HTTP_REFERER']); $url = preg_replace( "'\?(.*)'", "", $url); if(substr("$url", -1) == "/"){ $url = substr($url, 0, -1); } echo'

Important Configuration

Please fill in the required information before proceeding

 
 Full URL to CuteNews directory: should start with Http://
 URL to the file you plan to include CN in: should start with Http://
 
 Administrator Username:
 Password: REMEMBER your password!
 Retype Password:
 Nickname (optional)
 Email
 
'; } // ******************************************************************************** // Do Install // ******************************************************************************** elseif($action == "doinstall") { if(!$reg_username or !$reg_password1 or !$url or $reg_password1 != $reg_password2 ){ die("Bugger!
You either forgot to fill in one or more required fields, or the passwords didn't match"); } $reg_password = md5(md5($reg_password1)); $users_file = fopen("./data/users.db.php", "w") or die("Sorry mate, but the installer cannot write to the file ./data/users.db.php,
please check whether the file exists and/or is properly CHMOD`ed"); fwrite($users_file, "\n"); fwrite($users_file, time()."|1|$reg_username|$reg_password|$reg_nickname|$reg_email|0|0||||\n"); fclose($users_file); $config = << HTML; $con_file = fopen("./data/config.php", "w") or die("Sorry mate, but the installer cannot write to file ./data/config.php,
please check whether the file exists and/or is properly CHMOD`ed"); fwrite($con_file, $config); fclose($con_file); $path = str_replace( '\\', '/', getcwd() ); echo'

Installation Finished


CuteNews was successfully installed.

We recommend you read the CuteNews README file where the basics of maintaining a CuteNews site is explained.
You should also stop by the CuteNews official forums, but make sure you read the official FAQ and try searching the forum before asking for help. Thank you!

note: you should now delete ./inc/install.mdu for security reasons

You can now go to the CuteNews login page.

'; } // ******************************************************************************** // Start Installation Wizard // ******************************************************************************** else{ echo'

Welcome to the CuteNews AJ-Fork Installer


This wizard will guide you through all installation steps and help you configure the script.

This version is *NOT* official CutePHP material. You can get the script this was based on by visiting Cutephp.com.

This version is heavily modified by eruin/Øivind @ appelsinjuice.org. Any questions about the specific hacks in this version should obviously be directed to the a.org CN "crew": cutenews at appelsinjuice dor org. Make sure your email subject begins with "[aj-fork]", or it will be disregarded as spam.

'; } ?>
1
End credits

CuteNews AJ-Fork 166

1
Historical archive. This is a preserved copy of 36 Degrees Design (2005–2008), the early web-design weblog of Stuart Frisby. It is maintained independently as a piece of web history and is not operated by, affiliated with, or endorsed by Stuart Frisby. If you are the original owner and would like this domain returned, get in touch — it’s yours, no fuss.
Article Archive