/** * Allows access to a directory on the server. * * Access to the directory is restricted using a .htaccess file. * * If there is already a .htaccess file in the directory, it is backed up first. * * @param string $directory The name of the directory, relative to PROJECT_ROOT. */ public static function allow_access_to_directory($directory) { $validator = new FileSystem_ExistingDirectoryRelativeToProjectRootValidator(); if ($validator->validate($directory)) { $abs_directory = PROJECT_ROOT . DIRECTORY_SEPARATOR . $directory; $htaccess_file_name = $abs_directory . DIRECTORY_SEPARATOR . '.htaccess'; /* * Back up the old file. */ if (file_exists($htaccess_file_name)) { $back_up_htaccess_file_name = $htaccess_file_name . '_' . date('U'); rename($htaccess_file_name, $back_up_htaccess_file_name); } $copyright_holder = HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_holder(); $date = date('Y-m-d'); if ($fh = fopen($htaccess_file_name, 'w')) { $htaccess_file_content = <<<HTA # Allowing access to {$directory} # (c) {$date}, {$copyright_holder} Order Allow,Deny Allow from all HTA; fwrite($fh, $htaccess_file_content); fclose($fh); } } }
public static function get_start_page_widget_content() { $ul = new HTMLTags_UL(); $info = array('Title' => HaddockProjectOrganisation_ProjectInformationHelper::get_title(), 'Version' => HaddockProjectOrganisation_ProjectInformationHelper::get_version_code(), 'Copyright Holder' => HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_holder()); $dl = new HTMLTags_DL(); foreach ($info as $key => $value) { $dt = new HTMLTags_DT($key . ': '); $dd = new HTMLTags_DD($value); $dl->append($dt); $dl->append($dd); } return $dl; }
public function do_actions() { #$config_manager = Configuration_ConfigManagerHelper::get_config_manager('haddock', 'haddock-project-organisation'); /* * List the info. */ echo 'Information about your installation:' . PHP_EOL; #printf( # 'Release major version: \'%s\'' . PHP_EOL, # $config_manager->get_major_release_version() #); printf('Name: \'%s\'' . PHP_EOL, HaddockProjectOrganisation_ProjectInformationHelper::get_name()); printf('Title: \'%s\'' . PHP_EOL, HaddockProjectOrganisation_ProjectInformationHelper::get_title()); printf('Copyright Holder: \'%s\'' . PHP_EOL, HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_holder()); printf('Version Code: \'%s\'' . PHP_EOL, HaddockProjectOrganisation_ProjectInformationHelper::get_version_code()); printf('Camel Case Root: \'%s\'' . PHP_EOL, HaddockProjectOrganisation_ProjectInformationHelper::get_camel_case_root()); }
public function render_body_div_footer() { ?> <div id="footer" > <?php echo '© '; echo HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_date_string(); echo ', '; echo HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_holder(); echo PHP_EOL; ?> </div> <?php }
/** * Should this value be set for each module? */ public function get_copyright_holder() { return HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_holder(); }
private static function get_copyright_string() { $copyright_string = ''; /* * Create a date string. */ $date = date('Y-m-d'); /* * Get the name of the copyright holder of the project. */ $copyright_holder = HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_holder(); $copyright_string .= "{$date}, {$copyright_holder}"; return $copyright_string; }
public static function test_project_copyright_holder_is_settable_at_the_command_line() { #self::set_up(); $test_copyright_holder = 'Foo Bar'; system(PROJECT_ROOT . '/bin/HaddockProjectOrganisation_SetProjectInformationCLIScript.php --datum-name="Copyright Holder" --new-value="' . $test_copyright_holder . '"'); $test_result = HaddockProjectOrganisation_ProjectInformationHelper::get_copyright_holder() == $test_copyright_holder; #self::tear_down(); return $test_result; }